mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
Merge branch 'master' of https://github.com/Proxmark/proxmark3
Conflicts: armsrc/crapto1.c armsrc/iclass.c client/nonce2key/crapto1.c
This commit is contained in:
commit
3ac59c7fed
23 changed files with 726 additions and 964 deletions
|
@ -135,7 +135,7 @@ local Utils =
|
|||
while IN>0 do
|
||||
I=I+1
|
||||
IN , D = math.floor(IN/B), math.modf(IN,B)+1
|
||||
OUT=string.sub(K,D,D)..OUT
|
||||
OUT = string.sub(K,D,D)..OUT
|
||||
end
|
||||
return OUT
|
||||
end,
|
||||
|
@ -191,6 +191,30 @@ local Utils =
|
|||
return table.concat(t)
|
||||
end,
|
||||
|
||||
Chars2num = function(s)
|
||||
return (s:byte(1)*16777216)+(s:byte(2)*65536)+(s:byte(3)*256)+(s:byte(4))
|
||||
end,
|
||||
|
||||
-- use length of string to determine 8,16,32,64 bits
|
||||
bytes_to_int = function(str,endian,signed)
|
||||
local t={str:byte(1,-1)}
|
||||
if endian=="big" then --reverse bytes
|
||||
local tt={}
|
||||
for k=1,#t do
|
||||
tt[#t-k+1]=t[k]
|
||||
end
|
||||
t=tt
|
||||
end
|
||||
local n=0
|
||||
for k=1,#t do
|
||||
n=n+t[k]*2^((k-1)*8)
|
||||
end
|
||||
if signed then
|
||||
n = (n > 2^(#t*8-1) -1) and (n - 2^(#t*8)) or n -- if last bit set, negative.
|
||||
end
|
||||
return n
|
||||
end,
|
||||
|
||||
-- function convertStringToBytes(str)
|
||||
-- local bytes = {}
|
||||
-- local strLength = string.len(str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue