Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(3) | Call(3) | Derive(0) | Import(0)
Calculates the ISO-14443A CRC checksum
def crc(inbytes): """Calculates the ISO-14443A CRC checksum""" wCrc = 0x6363 for i in range(len(inbytes)): byte = ord(inbytes[i]) byte = (byte ^ (wCrc & 0x00FF)) byte = ((byte ^ (byte << 4)) & 0xFF) wCrc = ((wCrc >> 8) ^ (byte << 8) ^ (byte << 3) ^ (byte >> 4)) & 0xFFFF res = chr(wCrc & 0xFF) + chr((wCrc >> 8) & 0xff) return res
U_l = pycrypto1.bytes_to_long(uid[:4]) msg = "\x93\x70" + uid + py14443a.crc("\x93\x70" + uid) print "R -> T:", hex_dump(msg) select = nfc.transceive_bytes(msg)
# We turn the parity handling OFF when sending our own # Our auth message is for key type A on block 4 msg = "\x60\x00" + py14443a.crc("\x60\x00") nfc.configure(nfc.NDO_HANDLE_PARITY, False) print "R -> T:", hex_dump(msg)
ks2 = crypto1.get_word(0, 1) msg = "\x30\x00" + py14443a.crc("\x30\x00") par = py14443a.parity(msg)