1
0
mirror of https://github.com/biergaizi/codecrypt synced 2024-06-20 22:08:16 +00:00

cubehash_impl: fix cubehash implementation mistake

Well, there's a reason for that test vectors are published on wikipedia.

Although this looks scary (like writing past array bounds), cubehash B
parameter is in all cases smaller than 63 (which is the first B value where
this would write behind the array), so no harm is done. For similar reason, the
"misimplemented" cubehash was cryptographically correct (i.e. without
cryptographic weakness), only implemented differently and producing different
results than those prescribed by the standard.

Practical implications of changing the hash functions are:
- everyone gets a new KeyID
- FMTSeq keys that used cubehash are invalid now, users are forced to generate
  new ones
This commit is contained in:
Mirek Kratochvil 2016-04-28 12:37:38 +02:00
parent f3f1a805ce
commit 213331903e

@ -113,8 +113,8 @@ public:
for (; i < n; ++i)
X[i / 4] ^= ( (uint32_t) (data[i])) << ( (i % 4) * 8);
i++;
X[i / 2] ^= ( (uint32_t) 0x80) << ( (i % 4) * 8);
//i==n, n<128 (!)
X[i / 4] ^= ( (uint32_t) 0x80) << ( (i % 4) * 8);
rounds (R);