chg: adaptation.. made shortcut for Hexlify for ConvertAsciiToHex

This commit is contained in:
iceman1001 2018-07-27 09:36:47 +02:00
commit 2919a35665

View file

@ -47,9 +47,9 @@ local Utils =
return nil, string.format("Could not read file %s",filename)
end
local t = infile:read("*all")
io.close(infile)
len = string.len(t)
local _,hex = bin.unpack(("H%d"):format(len),t)
io.close(infile)
return hex
end,
@ -172,10 +172,7 @@ local Utils =
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
return core.sha1(s)
end
return nil
end,
@ -326,6 +323,11 @@ local Utils =
return table.concat(t)
end,
hexlify = function(s)
local u = require('utils')
return u.ConvertAsciiToHex(s)
end,
Chars2num = function(s)
return (s:byte(1)*16777216)+(s:byte(2)*65536)+(s:byte(3)*256)+(s:byte(4))
end,