From: valerij zaporogeci <vlrzprgts@gmail.com>
To: Michael Zimmermann <sigmaepsilon92@gmail.com>
Cc: edk2-devel <edk2-devel@lists.01.org>
Subject: Re: Crc32
Date: Tue, 30 Aug 2016 16:32:19 +0300 [thread overview]
Message-ID: <CANPuzFyVSeDnCVe28KQOpFJrhqOY3_Sb4fvGHX18uRckcXVz7g@mail.gmail.com> (raw)
In-Reply-To: <CAN9vWDLQV4iukCC-zQok=JW-ud7AST8m+omeGUzjdjR_c4Wk_A@mail.gmail.com>
Thank you.
But the polynomial value for CCITT crc32 is 104c11db7, not its tail 04c11db7.
And this whole mess with all those online calculators was the exact
reson I asked here. Because they mostly give WRONG result. As your
example. It's easy to check it's wrong. Because for example leading
zeroes in the message MUST not change the Crc32.
Here we have:
for 01 -> CD39D477
for 00 01 -> D71E16AC
and so on.
Also, it's obvious that Crc32(1) would be a polynomial without the
most significant non-zero bit, thus crc32 from 1 by the polynomial
104c11db7 would be 04c11b7.
The only online calculator so far giving right results is here:
https://ghsi.de/CRC/index.php?Polynom=100000100110000010001110110110111&Message=0104c11db7
I wrote function following the mathematics of the Crc and it gives
results exactly like in the above calculator.
It's fun to imagine what happens with such an incompatibilty for
example in case of GPT header.
2016-08-30 14:08 GMT+03:00, Michael Zimmermann <sigmaepsilon92@gmail.com>:
> well as u already said, the spec says it uses 'a standard CCITT32 CRC
> algorithm with a seed polynomial value of 0x04c11db7'
>
> this is the implementation which confirms it:
> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/RuntimeDxe/Crc32.c
>
> after testing it it indeed produces CCITT32 results like this online
> generator:
> http://g6auc.me.uk/CRC32/index.html
>
> Thanks
> Michael
>
> On Tue, Aug 30, 2016 at 2:54 AM, valerij zaporogeci <vlrzprgts@gmail.com>
> wrote:
>
>> Hi, all.
>> Yet another dumb question from me.
>> UEFI specification has Crc32 calculation service and uses Crc32 in
>> several places. but it only humbly mentions in the note somewhere in
>> the description of System Table about what exact one it wants. Namely
>> it states that the polynomial seed is 04c11db7. And that's all.
>> My question is - does really the specification means the 33-bit
>> polynomial
>> 104c11db7? And is the algorithm just a plain remainder calculation
>> without any additional pre/post processing of it? So that for example
>> Crc32 of the 4-byte sequence b16b00b5 would be
>> 8c1f0a7c?
>> Thank you.
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
>
next prev parent reply other threads:[~2016-08-30 13:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-30 0:54 Crc32 valerij zaporogeci
2016-08-30 11:08 ` Crc32 Michael Zimmermann
2016-08-30 13:32 ` valerij zaporogeci [this message]
2016-08-30 14:09 ` Crc32 Andrew Fish
2016-08-30 15:17 ` Crc32 valerij zaporogeci
2016-08-30 16:15 ` Crc32 Andrew Fish
2016-08-31 1:11 ` Crc32 valerij zaporogeci
2016-08-31 3:54 ` Crc32 Michael Zimmermann
2016-08-31 14:31 ` Crc32 valerij zaporogeci
2016-08-31 23:27 ` Crc32 valerij zaporogeci
2016-09-01 22:36 ` Crc32 valerij zaporogeci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANPuzFyVSeDnCVe28KQOpFJrhqOY3_Sb4fvGHX18uRckcXVz7g@mail.gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox