]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/lualibs/utils.lua
ADD: SHA1 hashes calculations in sha1.c and LUA
[proxmark3-svn] / client / lualibs / utils.lua
index a968fde2a90c3b2218b6e67aa005bdeec7486db6..41fb0856361c44c312be919dba6e9c903769bf3f 100644 (file)
@@ -99,7 +99,20 @@ local Utils =
                end\r
                return nil\r
        end,\r
-       \r
+\r
+       ------------ SHA1 hash\r
+       -- Takes a hex string and calculates a SHA1 hash\r
+       Sha1 = function(s)\r
+               if s == nil then return nil end\r
+               if #s == 0 then return nil end\r
+               if  type(s) == 'string' then\r
+                       local utils = require('utils')\r
+                       --local asc = utils.ConvertHexToAscii(s)\r
+                       local hash = core.sha1(s)\r
+                       return hash\r
+               end\r
+               return nil\r
+       end,    \r
        \r
        -- input parameter is a string\r
        -- Swaps the endianess and returns a number,  \r
Impressum, Datenschutz