diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-07-29 12:11:45 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-07-29 12:11:45 -0400 |
commit | 375b38554e7d8b8a2da8571eede97f3e52b57906 (patch) | |
tree | 56824a39f8c261bed1cbada969c13471f546d95c /rabbit.cpp | |
parent | 32d2ad1ca5e7f07186e149490f4dde62df65184e (diff) | |
download | cryptopp-git-375b38554e7d8b8a2da8571eede97f3e52b57906.tar.gz |
Use 64-bit multiply for Rabbit
Diffstat (limited to 'rabbit.cpp')
-rw-r--r-- | rabbit.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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)
|