On Saturday, April 20, 2019 at 6:49:20 AM UTC-4, [email protected] wrote:
>
> I use Crypto++ static library to define a function to calculate the value 
> of CRC32. But the calculated value of CRC32 is different from the expected 
> value.
> The expected value is a609ef3c
> But the actual value is 3cef09a6.
> Platform: windows 10 1809
> Compiler tool: visual studio 2017 Enterprise
> Library version: 8.10
>
> #include "crc.h"
> string CRC32_Bytes(PBYTE pData, DWORD dwDataSize)
> {
> string value;
> CRC32 crc32;
> StringSource(pData, dwDataSize, true, new HashFilter(crc32, new 
> HexEncoder(new StringSink(value))));
> return value;
> }
>

I'm guessing the algorithm from the other program uses little-endian 
format? Or maybe does something with an INT cast? That's OK as long as you 
do it everywhere.

It looks like you need reverse the bytes to present them in a manner that 
is expected. Maybe something like 
https://stackoverflow.com/a/49226781/608639 .

Crypto++ runs on little- and big-endian machines. It follows published 
self-tests, like Castagnoli's CRC32C (iSCSI), and arrives at the correct 
results on both types of hardware.

Jeff

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to