mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-09 06:23:44 +08:00
fix wrong terminology - LRC/CRC and calulate result instead of matching (thanks Henryk!)
This commit is contained in:
parent
c5847014fd
commit
98af9ddf8c
1 changed files with 12 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# xorcheck.py - find xor values for 8-bit CRC
|
# xorcheck.py - find xor values for 8-bit LRC
|
||||||
#
|
#
|
||||||
# Adam Laurie <adam@algroup.co.uk>
|
# Adam Laurie <adam@algroup.co.uk>
|
||||||
# http://rfidiot.org/
|
# http://rfidiot.org/
|
||||||
|
@ -25,12 +25,12 @@ import os
|
||||||
|
|
||||||
if(len(sys.argv) < 3):
|
if(len(sys.argv) < 3):
|
||||||
print
|
print
|
||||||
print '\t'+sys.argv[0] + ' - Generate final byte for XOR CRC'
|
print '\t'+sys.argv[0] + ' - Generate final byte for XOR LRC'
|
||||||
print
|
print
|
||||||
print 'Usage: ' + sys.argv[0] + ' <ID Byte1> <ID Byte2> ... <CRC>'
|
print 'Usage: ' + sys.argv[0] + ' <ID Byte1> <ID Byte2> ... <LRC>'
|
||||||
print
|
print
|
||||||
print '\tSpecifying the bytes of a UID with a known CRC will find the last byte value'
|
print '\tSpecifying the bytes of a UID with a known LRC will find the last byte value'
|
||||||
print '\tneeded to generate that CRC with a rolling XOR. All bytes should be specified in HEX.'
|
print '\tneeded to generate that LRC with a rolling XOR. All bytes should be specified in HEX.'
|
||||||
print
|
print
|
||||||
print 'Example:'
|
print 'Example:'
|
||||||
print
|
print
|
||||||
|
@ -38,19 +38,15 @@ if(len(sys.argv) < 3):
|
||||||
print
|
print
|
||||||
print 'Should produce the output:'
|
print 'Should produce the output:'
|
||||||
print
|
print
|
||||||
print '\tTarget (BA) matched with final byte value: 5A'
|
print '\tTarget (BA) matched with final LRC XOR byte value: 5A'
|
||||||
print
|
print
|
||||||
os._exit(True)
|
os._exit(True)
|
||||||
|
|
||||||
target= int(sys.argv[len(sys.argv) - 1],16)
|
target= int(sys.argv[len(sys.argv) - 1],16)
|
||||||
|
|
||||||
for candidate in range(256):
|
lrc= 0x00
|
||||||
crc= 0x00
|
for i in range(len(sys.argv) - 1):
|
||||||
for i in range(len(sys.argv) - 2):
|
lrc ^= int(sys.argv[i + 1],16)
|
||||||
crc ^= int(sys.argv[i + 1],16)
|
print
|
||||||
crc ^= candidate
|
print 'Target (%02X) requires final LRC XOR byte value: %02X' % (target,lrc)
|
||||||
if (crc == target):
|
print
|
||||||
print
|
|
||||||
print 'Target (%02X) matched with final byte value: %02X' % (target,candidate)
|
|
||||||
print
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue