Actually encode the number of bits in big endian
This commit is contained in:
parent
cf2b617b39
commit
d4b2d07c6e
13
puer.c
13
puer.c
|
@ -200,10 +200,15 @@ void finalize_hash(struct hashstate *state, unsigned char hash[32]) {
|
|||
}
|
||||
|
||||
// Add the number of bits, and do one last compression
|
||||
word2bytes(&state->buffer[state->length], state->totalbits>>32);
|
||||
state->length += 4;
|
||||
word2bytes(&state->buffer[state->length], state->totalbits & 0xffffffffUL);
|
||||
state->length += 4;
|
||||
state->buffer[8] = state->totalbits >> 56;
|
||||
state->buffer[9] = state->totalbits >> 48;
|
||||
state->buffer[10] = state->totalbits >> 40;
|
||||
state->buffer[11] = state->totalbits >> 32;
|
||||
state->buffer[12] = state->totalbits >> 24;
|
||||
state->buffer[13] = state->totalbits >> 16;
|
||||
state->buffer[14] = state->totalbits >> 8;
|
||||
state->buffer[15] = state->totalbits;
|
||||
state->length += 8;
|
||||
compress_hash(state);
|
||||
|
||||
// Extract the hash state
|
||||
|
|
Loading…
Reference in New Issue