aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/tiger/tiger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash/tiger/tiger.cpp')
-rw-r--r--src/hash/tiger/tiger.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp
index dd41841c9..d931324e0 100644
--- a/src/hash/tiger/tiger.cpp
+++ b/src/hash/tiger/tiger.cpp
@@ -17,14 +17,25 @@ namespace {
/*
* Tiger Mixing Function
*/
-inline void mix(u64bit X[8])
+inline void mix(MemoryRegion<u64bit>& X)
{
- X[0] -= X[7] ^ 0xA5A5A5A5A5A5A5A5; X[1] ^= X[0];
- X[2] += X[1]; X[3] -= X[2] ^ ((~X[1]) << 19); X[4] ^= X[3];
- X[5] += X[4]; X[6] -= X[5] ^ ((~X[4]) >> 23); X[7] ^= X[6];
- X[0] += X[7]; X[1] -= X[0] ^ ((~X[7]) << 19); X[2] ^= X[1];
- X[3] += X[2]; X[4] -= X[3] ^ ((~X[2]) >> 23); X[5] ^= X[4];
- X[6] += X[5]; X[7] -= X[6] ^ 0x0123456789ABCDEF;
+ X[0] -= X[7] ^ 0xA5A5A5A5A5A5A5A5;
+ X[1] ^= X[0];
+ X[2] += X[1];
+ X[3] -= X[2] ^ ((~X[1]) << 19);
+ X[4] ^= X[3];
+ X[5] += X[4];
+ X[6] -= X[5] ^ ((~X[4]) >> 23);
+ X[7] ^= X[6];
+
+ X[0] += X[7];
+ X[1] -= X[0] ^ ((~X[7]) << 19);
+ X[2] ^= X[1];
+ X[3] += X[2];
+ X[4] -= X[3] ^ ((~X[2]) >> 23);
+ X[5] ^= X[4];
+ X[6] += X[5];
+ X[7] -= X[6] ^ 0x0123456789ABCDEF;
}
}
@@ -71,7 +82,9 @@ void Tiger::copy_out(byte output[])
/*
* Tiger Pass
*/
-void Tiger::pass(u64bit& A, u64bit& B, u64bit& C, u64bit X[8], byte mul)
+void Tiger::pass(u64bit& A, u64bit& B, u64bit& C,
+ const MemoryRegion<u64bit>& X,
+ byte mul)
{
C ^= X[0];
A -= SBOX1[get_byte(7, C)] ^ SBOX2[get_byte(5, C)] ^