mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
chg: adaptation.. made shortcut for Hexlify for ConvertAsciiToHex
This commit is contained in:
parent
6d4d58659f
commit
2919a35665
1 changed files with 23 additions and 21 deletions
|
@ -47,9 +47,9 @@ local Utils =
|
||||||
return nil, string.format("Could not read file %s",filename)
|
return nil, string.format("Could not read file %s",filename)
|
||||||
end
|
end
|
||||||
local t = infile:read("*all")
|
local t = infile:read("*all")
|
||||||
|
io.close(infile)
|
||||||
len = string.len(t)
|
len = string.len(t)
|
||||||
local _,hex = bin.unpack(("H%d"):format(len),t)
|
local _,hex = bin.unpack(("H%d"):format(len),t)
|
||||||
io.close(infile)
|
|
||||||
return hex
|
return hex
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -172,10 +172,7 @@ local Utils =
|
||||||
if s == nil then return nil end
|
if s == nil then return nil end
|
||||||
if #s == 0 then return nil end
|
if #s == 0 then return nil end
|
||||||
if type(s) == 'string' then
|
if type(s) == 'string' then
|
||||||
local utils = require('utils')
|
return core.sha1(s)
|
||||||
--local asc = utils.ConvertHexToAscii(s)
|
|
||||||
local hash = core.sha1(s)
|
|
||||||
return hash
|
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end,
|
end,
|
||||||
|
@ -326,6 +323,11 @@ local Utils =
|
||||||
return table.concat(t)
|
return table.concat(t)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
hexlify = function(s)
|
||||||
|
local u = require('utils')
|
||||||
|
return u.ConvertAsciiToHex(s)
|
||||||
|
end,
|
||||||
|
|
||||||
Chars2num = function(s)
|
Chars2num = function(s)
|
||||||
return (s:byte(1)*16777216)+(s:byte(2)*65536)+(s:byte(3)*256)+(s:byte(4))
|
return (s:byte(1)*16777216)+(s:byte(2)*65536)+(s:byte(3)*256)+(s:byte(4))
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue