Use 64-bit multiply for Rabbit

pull/696/head
Jeffrey Walton 2018-07-29 12:11:45 -04:00
parent 32d2ad1ca5
commit 375b38554e
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 8 additions and 0 deletions

View File

@ -15,10 +15,12 @@
ANONYMOUS_NAMESPACE_BEGIN
using CryptoPP::word32;
using CryptoPP::word64;
using CryptoPP::rotlConstant;
word32 G_func(word32 x)
{
#if 0
/* Temporary variables */
word32 a, b, h, l;
@ -32,6 +34,12 @@ word32 G_func(word32 x)
/* Return high XOR low */
return static_cast<word32>(h^l);
#endif
// Thanks to Jack Lloyd for suggesting the 64-bit multiply.
word64 z = x;
z *= x;
return static_cast<word32>((z >> 32) ^ z);
}
word32 NextState(word32 c[8], word32 x[8], word32 carry)