X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/ea75b30c81839eb6eb27f083572f03e317ba63d2..9783989b400be4ed19cbf12defa4d6dbcdcd9fc8:/client/lualibs/utils.lua

diff --git a/client/lualibs/utils.lua b/client/lualibs/utils.lua
index 41fb0856..da179758 100644
--- a/client/lualibs/utils.lua
+++ b/client/lualibs/utils.lua
@@ -37,9 +37,7 @@ local Utils =
 	------------ FILE READING
 	ReadDumpFile = function (filename)
 	
-		if filename == nil then 
-			return nil, 'Filename is empty'
-		end
+		filename = filename or 'dumpdata.bin'
 		if #filename == 0 then
 			return nil, 'Filename length is zero'
 		end
@@ -101,7 +99,7 @@ local Utils =
 	end,
 
 	------------ SHA1 hash
-	-- Takes a hex string and calculates a SHA1 hash
+	-- Takes a string and calculates a SHA1 hash
 	Sha1 = function(s)
 		if s == nil then return nil end
 		if #s == 0 then return nil end
@@ -113,6 +111,19 @@ local Utils =
 		end
 		return nil
 	end,	
+	-- Takes a hex string and calculates a SHA1 hash
+	Sha1Hex = function(s)
+		if s == nil then return nil end
+		if #s == 0 then return nil end
+		if  type(s) == 'string' then
+			local utils = require('utils')
+			local asc = utils.ConvertHexToAscii(s)
+			local hash = core.sha1(asc)
+			return hash
+		end
+		return nil
+	end,	
+
 	
 	-- input parameter is a string
 	-- Swaps the endianess and returns a number,