Hi I hit an issue with crc32 implementation in NuttX's LibC and it took me some time to figure out that crc32 is implemented differently in NuttX than I was expecting. Let me explain...
Common implementations are using same precomputed table as there is in the NuttX, but the initial value is all ones and not zero as in case of the NuttX (0xffffffff vs 0x0) and the result is negated while that is not true in the NuttX. In other words the call `crc32(msg, msgsiz)` gives "unexpected" result while `~crc32part(msg, msgsiz, 0xffffffff)` gives the "correct" one. I can see the idea behind not performing negation twice (`crc32part` would have to negate `crc32val` at the start and then return it negated again) but using the same precomputed table gives then different results. I am not sure if this weakens the crc32 in some way or just has no side effect except of not matching with common implementations. Either way this discrepancy should be at least documented with suggestion to use `~crc32part(msg, msgsiz, 0xffffffff)`. What do you think? With regards Karel Kočí
pgp6TVLW_iARV.pgp
Description: PGP signature