fixes #122 adler32 vs. crc32 inconsistency (bad byte order)
This commit is contained in:
parent
33e1c4acca
commit
a4d61e0bea
@ -175,7 +175,7 @@ void crc32_finish(crc32_state *ctx, void *hash, unsigned long size)
|
||||
|
||||
if (size > 4) size = 4;
|
||||
for (i = 0; i < size; i++) {
|
||||
h[i] = ((unsigned char*)&(crc))[i];
|
||||
h[i] = ((unsigned char*)&(crc))[size-i-1];
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ int crc32_test(void)
|
||||
return CRYPT_NOP;
|
||||
#else
|
||||
const void* in = "libtomcrypt";
|
||||
const unsigned char crc32[] = { 0xef, 0x76, 0x73, 0xb3 };
|
||||
const unsigned char crc32[] = { 0xb3, 0x73, 0x76, 0xef };
|
||||
unsigned char out[4];
|
||||
crc32_state ctx;
|
||||
crc32_init(&ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user