What is the correct CRC value for a zero length check?

0

I have a CRC-32/ISO-HDLC calculation function which is coded in 'C'. It works fine in that if I feed it '123456789' it give the correct result 0xCBF43926. However what is the correct result I should get for the empty string '' ?

My function gives '0x00000000' which is understandable given the way the code is written. But the reference calculator I am checking against gives 0xD202EF8D !!

I am checking against this tool : https://crccalc.com/?crc=&method=crc32&datatype=ascii&outtype=hex

My code is based on this reference : https://tools.ietf.org/html/rfc1662 which uses a lookup table technique.

Some other online tools also give 0x0000 for zero length input. Which tool is correct on this subject ?

crc32
asked on Stack Overflow Apr 23, 2020 by user3314691

1 Answer

0

I am checking against this tool : https://crccalc.com/?crc=&method=crc32&datatype=ascii&outtype=hex

I am not convinced that this tool works for zero lengths. A value of 0x00000000 is correct for a zero length.

It does works correctly for me with all kinds of other data lengths and data.

answered on Stack Overflow Apr 23, 2020 by Gerhard

User contributions licensed under CC BY-SA 3.0