add @Iceman1001 s sha1 scripting changes.

This commit is contained in:
marshmellow42 2015-05-30 21:51:15 -04:00
commit 1c4c0b0681
6 changed files with 981 additions and 6 deletions

View file

@ -99,6 +99,32 @@ local Utils =
end
return nil
end,
------------ 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
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,
-- 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
@ -288,4 +314,4 @@ local Utils =
-- end
}
return Utils
return Utils