weidai11 / cryptopp

free C++ class library of cryptographic schemes
https://cryptopp.com
Other
4.67k stars 1.47k forks source link

byte order of crc32 #1184

Closed Pumaly closed 1 year ago

Pumaly commented 1 year ago

the byte order of crc32 does not match。

CRC32 crc32; StringSource(plain, true, new HashFilter(crc32, new HexEncoder(new StringSink(dst)))); The general result is 6D8A7EF2,but F2A78E6D.

void CRC32::TruncatedFinal(byte *hash, size_t size) { ThrowIfInvalidTruncatedSize(size);

m_crc ^= CRC32_NEGL;
for (size_t i=0; i<size; i++)
    hash[i] = GetCrcByte(i);

Reset();

}

noloader commented 1 year ago

Please ask questions on the mailing list.

Pumaly commented 1 year ago

the location of this code should has judge for Little-Endian?