X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/b69947c24598e870b0f08d661e10e390330e38a6..ea75b30c81839eb6eb27f083572f03e317ba63d2:/client/lualibs/utils.lua?ds=sidebyside diff --git a/client/lualibs/utils.lua b/client/lualibs/utils.lua index a968fde2..41fb0856 100644 --- a/client/lualibs/utils.lua +++ b/client/lualibs/utils.lua @@ -99,7 +99,20 @@ local Utils = end return nil end, - + + ------------ SHA1 hash + -- Takes a hex string and calculates a SHA1 hash + Sha1 = 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(s) + return hash + end + return nil + end, -- input parameter is a string -- Swaps the endianess and returns a number,