mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-14 02:26:59 -07:00
add @Iceman1001 s sha1 scripting changes.
This commit is contained in:
parent
185e038c7d
commit
1c4c0b0681
6 changed files with 981 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue