NTAG424 DNA: Request for Detailed Algorithm of CRC32NK for ChangeKey CommandDear NXP Team,
I'm working with the NTAG424 DNA and encountered an issue when calculating the CRC32NK for the ChangeKey command. When using common standard CRC32 algorithms to compute the checksum for the example key value provided in Table 25 of document AN12196, the result does not match the example checksum given.
For reference,
The example key value from the table is: F3847D627727ED3BC9C4CC050489B966
The corresponding example CRC32 result provided is: 789DFADC
Could you please clarify the specific parameters or variant of the CRC32 algorithm used for CRC32NK in this context? Details such as the polynomial, initial value, input/output bit reversal, and final XOR value would be extremely helpful.
Thank you for your support!
NFC Frontend SolutionsRe: NTAG424 DNA: Request for Detailed Algorithm of CRC32NK for ChangeKey CommandHello @xscarecrow
Hope you are doing well.
According to NTAG 424 DNA Data Sheet, Section 10.6.1 ChangeKey, CRC32NK is the 4-byte CRC value computed according to IEEE Std 802.3-2008 (FCS Field) over NewKey.
Regards,
Eduardo.
Re: NTAG424 DNA: Request for Detailed Algorithm of CRC32NK for ChangeKey CommandFor all those who did see the "CRC32NK from IEEE Std 802.3-2008" footnote in the datasheet but still didn't get the right answer:
Following the TalkToYourNTAG424DNACard [1] and/or the NTAG424-SDM [2] repository, here a summary of the necessary reflecting and XOR'ing (in Python from [2] because shorter):
from binascii import unhexlify, crc32
def Crc32_NK(data: bytes) -> bytes:
crc = crc32(data) ^ 0xFFFFFFFF
return crc.to_bytes(4, byteorder="little")
assert (Crc32_NK(unhexlify('F3847D627727ED3BC9C4CC050489B966'))==unhexlify('789DFADC'))
[1] https://github.com/MichaelsPlayground/TalkToYourNTAG424DNACard/blob/master/app/src/main/java/de/andr...
[2] https://github.com/luu176/NTAG424-SDM/blob/main/main.py#L119
Re: NTAG424 DNA: Request for Detailed Algorithm of CRC32NK for ChangeKey CommandYou are a legend my friend. Thanks!