Closed Brandonn-Etheve closed 2 years ago
I'll have a look ...
Got the same results as you (so it is at least consistent) CRC32_test.ino 89A1897F 89A1897F 89A1897F CDBAC17A 18
These are the settings, these are NOT in the table at crccalc.com
void CRC32::reset()
{
_polynome = CRC32_DEFAULT_POLYNOME; (== 0x04C11DB7)
_startMask = 0;
_endMask = 0;
_crc = 0;
_reverseIn = false;
_reverseOut = false;
_started = false;
_count = 0;
}
Checking with - http://zorc.breitbandkatze.de/crc.html and values seems OK.
Think you missed the XOR with 0xFFFFFF at the end (in the crccalc table)
CDBAC17A is the CRC-32 when adding the string 123456789 twice.
Thanks for your time. since there was a comment in the example sketch : // Serial.println("Verified with - https://crccalc.com/\n"); i though that the default setting should match the output of that website.
Using: crc.setPolynome(0x04C11DB7); crc.setStartXOR(0xFFFFFFFF); crc.setEndXOR(0xFFFFFFFF); crc.setReverseIn(true); crc.setReverseOut(true);
the output is CBF43926 as expected. since many website use those setting (including https://crc32.online/ and other) maybe you should use it as default setting, or add the link to http://zorc.breitbandkatze.de/crc.html instead of https://crccalc.com in the sketch comment. Anyways issue solved.
Good point to use at least a setting that is in the table. I'll make a note of it for a next release to improve the examples.
Might be useful to have a dump() function to print all settings at once. => easier to check them.
FYI triggered by your question I created a 0.2.0 version
Running included crc32 example sketch on an arduino uno i get:
/home/brd/Arduino/libraries/CRC/examples/CRC32_test/CRC32_test.ino 89A1897F 89A1897F 89A1897F CDBAC17A 18
while https://crccalc.com/ with "123456789" input: ascii, output: hex, i get: 0xCBF43926
here the crccalc result link
What i'm missing?