Excerpts from Nathan Hartman's message of July 20, 2022 4:32 pm:
> On Wed, Jul 20, 2022 at 10:24 AM Karel Kočí <cyn...@email.cz> wrote:
>>
>> Sorry for the late response.. I was busy with life.
>>
>> No, NuttX's crc32 is returning 0x2DFD2D88!
>> My modified code with missing negation returns that 0x340BC6D9 but that is 
>> now
>> probably no longer relevant. We should now probably only consider what is the
>> NuttX's crc32 implementation at the moment so its usage would be clear. I
>> dragged there originally my requirement of the algorithm and in the end that 
>> got
>> confusing.
>>
>> The parameters that give me same test value from NuttX code as on 
>> crc_js.html:
>>
>>   Input reflected: yes
>>   Result reflected: yes
>>   Polynomial: 0x4C11DB7
>>   Initial Value: 0x0
>>   Final Xor Value: 0x0
> 
> snip
> 
>> The NuttX's implementation should be probably something like 
>> `crc32_posixlike`
>> as it is not even POSIX compliant implementation due to the input and output 
>> not
>> being reflected and output not being negated. Thus possibly `crc32_nuttx`.
> 
> To clarify, you're saying that:
> 
> In POSIX the input and output are NOT reflected and the output is NOT
> negated, and:
That is what http://www.sunshine2k.de/coding/javascript/crc/crc_js.html and 
https://reveng.sourceforge.io/crc-catalogue/all.htm state as POSIX (haven't 
check posix standard for that).

> In NuttX the input and output ARE reflected and the output IS negated?
That is what gives me the same value on crc_js.html as I get from simple code 
run in NuttX application (SAMV7):

  printf("crc: %x\n", crc32("123456789", 9));

Previously I tested the code also on amd64 and MIPS and it gave the same result 
as the code on NuttX (I just took the crc32 calculation code as it is in NuttX 
and dropped it to the very simple C file to test it).

K.K.

Attachment: pgpsdHUBZarjt.pgp
Description: PGP signature

Reply via email to