mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
ADD: added the crc8legic to Lua. call it with core.crc8legic
also a helper function to take a hexstring and calc the crc on it, was added inside utils.lua Call it inside a lua-script like this: local utils = require('utils') local data = '01020304' local crc = utils.Crc8Legic(data) print (uid, ('%02x'):format(crc))
This commit is contained in:
parent
c0f15a05b3
commit
a75d63f19b
3 changed files with 43 additions and 16 deletions
|
@ -82,6 +82,20 @@ local Utils =
|
|||
return nil
|
||||
end,
|
||||
|
||||
------------ CRC-16 ccitt checksums
|
||||
-- Takes a hex string and calculates a crc16
|
||||
Crc8Legic = 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.crc8legic(asc)
|
||||
return hash
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
|
||||
------------ CRC-16 ccitt checksums
|
||||
-- Takes a hex string and calculates a crc16
|
||||
Crc16 = function(s)
|
||||
|
@ -96,6 +110,7 @@ local Utils =
|
|||
return nil
|
||||
end,
|
||||
|
||||
|
||||
------------ CRC-64 ecma checksums
|
||||
-- Takes a hex string and calculates a crc64 ecma
|
||||
Crc64 = function(s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue