Skip to content

Commit 1fe489f

Browse files
committed
Fix hefty1 hashing
1 parent 4a686c0 commit 1fe489f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hefty1.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ void hefty1_hash(const char* input, char* output, uint32_t len)
5151
uint32_t i;
5252
uint32_t j;
5353

54+
#define OUTPUT_BIT (i * 4 + j)
55+
5456
for(i = 0; i < 64; i++) {
5557
for(j = 0; j < 4; j++) {
56-
if((*(hash[j] + i) & 0x80) != 0)
57-
output[((i * 4 + j) - (i * 4 + j) % 8) / 8] |= 1 << (i * 4 + j) % 8;
58+
if((*(hash[j] + (i / 8)) & (0x80 >> (i % 8))) != 0)
59+
*(output + (OUTPUT_BIT / 8)) |= 0x80 >> (OUTPUT_BIT % 8);
5860
}
5961
}
6062

0 commit comments

Comments
 (0)