aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash')
-rw-r--r--src/hash/md4/md4.cpp9
-rw-r--r--src/hash/md5/md5.cpp9
-rw-r--r--src/hash/rmd160/rmd160.cpp23
-rw-r--r--src/hash/sha1/sha160.cpp13
-rw-r--r--src/hash/sha2/sha2_32.cpp19
-rw-r--r--src/hash/sha2/sha2_64.cpp185
-rw-r--r--src/hash/tiger/tiger.cpp8
7 files changed, 145 insertions, 121 deletions
diff --git a/src/hash/md4/md4.cpp b/src/hash/md4/md4.cpp
index c6adeb744..83302f215 100644
--- a/src/hash/md4/md4.cpp
+++ b/src/hash/md4/md4.cpp
@@ -45,14 +45,14 @@ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S)
*************************************************/
void MD4::compress_n(const byte input[], u32bit blocks)
{
+ u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
+
for(u32bit i = 0; i != blocks; ++i)
{
for(u32bit j = 0; j != 16; ++j)
M[j] = load_le<u32bit>(input, j);
input += HASH_BLOCK_SIZE;
- u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
-
FF(A,B,C,D,M[ 0], 3); FF(D,A,B,C,M[ 1], 7); FF(C,D,A,B,M[ 2],11);
FF(B,C,D,A,M[ 3],19); FF(A,B,C,D,M[ 4], 3); FF(D,A,B,C,M[ 5], 7);
FF(C,D,A,B,M[ 6],11); FF(B,C,D,A,M[ 7],19); FF(A,B,C,D,M[ 8], 3);
@@ -74,7 +74,10 @@ void MD4::compress_n(const byte input[], u32bit blocks)
HH(A,B,C,D,M[ 3], 3); HH(D,A,B,C,M[11], 9); HH(C,D,A,B,M[ 7],11);
HH(B,C,D,A,M[15],15);
- digest[0] += A; digest[1] += B; digest[2] += C; digest[3] += D;
+ A = (digest[0] += A);
+ B = (digest[1] += B);
+ C = (digest[2] += C);
+ D = (digest[3] += D);
}
}
diff --git a/src/hash/md5/md5.cpp b/src/hash/md5/md5.cpp
index 7adac69d3..9a675850a 100644
--- a/src/hash/md5/md5.cpp
+++ b/src/hash/md5/md5.cpp
@@ -58,14 +58,14 @@ inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
*************************************************/
void MD5::compress_n(const byte input[], u32bit blocks)
{
+ u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
+
for(u32bit i = 0; i != blocks; ++i)
{
for(u32bit j = 0; j != 16; ++j)
M[j] = load_le<u32bit>(input, j);
input += HASH_BLOCK_SIZE;
- u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
-
FF(A,B,C,D,M[ 0], 7,0xD76AA478); FF(D,A,B,C,M[ 1],12,0xE8C7B756);
FF(C,D,A,B,M[ 2],17,0x242070DB); FF(B,C,D,A,M[ 3],22,0xC1BDCEEE);
FF(A,B,C,D,M[ 4], 7,0xF57C0FAF); FF(D,A,B,C,M[ 5],12,0x4787C62A);
@@ -102,7 +102,10 @@ void MD5::compress_n(const byte input[], u32bit blocks)
II(A,B,C,D,M[ 4], 6,0xF7537E82); II(D,A,B,C,M[11],10,0xBD3AF235);
II(C,D,A,B,M[ 2],15,0x2AD7D2BB); II(B,C,D,A,M[ 9],21,0xEB86D391);
- digest[0] += A; digest[1] += B; digest[2] += C; digest[3] += D;
+ A = (digest[0] += A);
+ B = (digest[1] += B);
+ C = (digest[2] += C);
+ D = (digest[3] += D);
}
}
diff --git a/src/hash/rmd160/rmd160.cpp b/src/hash/rmd160/rmd160.cpp
index e8961ac67..249ce7fb1 100644
--- a/src/hash/rmd160/rmd160.cpp
+++ b/src/hash/rmd160/rmd160.cpp
@@ -73,6 +73,11 @@ inline void F5(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E,
*************************************************/
void RIPEMD_160::compress_n(const byte input[], u32bit blocks)
{
+ const u32bit MAGIC2 = 0x5A827999, MAGIC3 = 0x6ED9EBA1,
+ MAGIC4 = 0x8F1BBCDC, MAGIC5 = 0xA953FD4E,
+ MAGIC6 = 0x50A28BE6, MAGIC7 = 0x5C4DD124,
+ MAGIC8 = 0x6D703EF3, MAGIC9 = 0x7A6D76E9;
+
for(u32bit i = 0; i != blocks; ++i)
{
for(u32bit j = 0; j != 16; ++j)
@@ -80,13 +85,8 @@ void RIPEMD_160::compress_n(const byte input[], u32bit blocks)
input += HASH_BLOCK_SIZE;
u32bit A1 = digest[0], A2 = A1, B1 = digest[1], B2 = B1,
- C1 = digest[2], C2 = C1, D1 = digest[3], D2 = D1,
- E1 = digest[4], E2 = E1;
-
- const u32bit MAGIC2 = 0x5A827999, MAGIC3 = 0x6ED9EBA1,
- MAGIC4 = 0x8F1BBCDC, MAGIC5 = 0xA953FD4E,
- MAGIC6 = 0x50A28BE6, MAGIC7 = 0x5C4DD124,
- MAGIC8 = 0x6D703EF3, MAGIC9 = 0x7A6D76E9;
+ C1 = digest[2], C2 = C1, D1 = digest[3], D2 = D1,
+ E1 = digest[4], E2 = E1;
F1(A1,B1,C1,D1,E1,M[ 0],11 ); F5(A2,B2,C2,D2,E2,M[ 5], 8,MAGIC6);
F1(E1,A1,B1,C1,D1,M[ 1],14 ); F5(E2,A2,B2,C2,D2,M[14], 9,MAGIC6);
@@ -173,9 +173,12 @@ void RIPEMD_160::compress_n(const byte input[], u32bit blocks)
F5(C1,D1,E1,A1,B1,M[15], 5,MAGIC5); F1(C2,D2,E2,A2,B2,M[ 9],11 );
F5(B1,C1,D1,E1,A1,M[13], 6,MAGIC5); F1(B2,C2,D2,E2,A2,M[11],11 );
- C1 = digest[1] + C1 + D2; digest[1] = digest[2] + D1 + E2;
- digest[2] = digest[3] + E1 + A2; digest[3] = digest[4] + A1 + B2;
- digest[4] = digest[0] + B1 + C2; digest[0] = C1;
+ C1 = digest[1] + C1 + D2;
+ digest[1] = digest[2] + D1 + E2;
+ digest[2] = digest[3] + E1 + A2;
+ digest[3] = digest[4] + A1 + B2;
+ digest[4] = digest[0] + B1 + C2;
+ digest[0] = C1;
}
}
diff --git a/src/hash/sha1/sha160.cpp b/src/hash/sha1/sha160.cpp
index 302151921..231dbeb12 100644
--- a/src/hash/sha1/sha160.cpp
+++ b/src/hash/sha1/sha160.cpp
@@ -54,6 +54,9 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg)
*************************************************/
void SHA_160::compress_n(const byte input[], u32bit blocks)
{
+ u32bit A = digest[0], B = digest[1], C = digest[2],
+ D = digest[3], E = digest[4];
+
for(u32bit i = 0; i != blocks; ++i)
{
for(u32bit j = 0; j != 16; j += 4)
@@ -73,9 +76,6 @@ void SHA_160::compress_n(const byte input[], u32bit blocks)
W[j+3] = rotate_left((W[j ] ^ W[j-5] ^ W[j-11] ^ W[j-13]), 1);
}
- u32bit A = digest[0], B = digest[1], C = digest[2],
- D = digest[3], E = digest[4];
-
F1(A,B,C,D,E,W[ 0]); F1(E,A,B,C,D,W[ 1]); F1(D,E,A,B,C,W[ 2]);
F1(C,D,E,A,B,W[ 3]); F1(B,C,D,E,A,W[ 4]); F1(A,B,C,D,E,W[ 5]);
F1(E,A,B,C,D,W[ 6]); F1(D,E,A,B,C,W[ 7]); F1(C,D,E,A,B,W[ 8]);
@@ -108,8 +108,11 @@ void SHA_160::compress_n(const byte input[], u32bit blocks)
F4(A,B,C,D,E,W[75]); F4(E,A,B,C,D,W[76]); F4(D,E,A,B,C,W[77]);
F4(C,D,E,A,B,W[78]); F4(B,C,D,E,A,W[79]);
- digest[0] += A; digest[1] += B; digest[2] += C;
- digest[3] += D; digest[4] += E;
+ A = (digest[0] += A);
+ B = (digest[1] += B);
+ C = (digest[2] += C);
+ D = (digest[3] += D);
+ E = (digest[4] += E);
}
}
diff --git a/src/hash/sha2/sha2_32.cpp b/src/hash/sha2/sha2_32.cpp
index be2638747..52528e6fd 100644
--- a/src/hash/sha2/sha2_32.cpp
+++ b/src/hash/sha2/sha2_32.cpp
@@ -48,6 +48,10 @@ inline void F1(u32bit A, u32bit B, u32bit C, u32bit& D,
*************************************************/
void SHA_224_256_BASE::compress_n(const byte input[], u32bit blocks)
{
+ u32bit A = digest[0], B = digest[1], C = digest[2],
+ D = digest[3], E = digest[4], F = digest[5],
+ G = digest[6], H = digest[7];
+
for(u32bit i = 0; i != blocks; ++i)
{
for(u32bit j = 0; j != 16; ++j)
@@ -58,10 +62,6 @@ void SHA_224_256_BASE::compress_n(const byte input[], u32bit blocks)
W[j] = sigma(W[j- 2], 17, 19, 10) + W[j- 7] +
sigma(W[j-15], 7, 18, 3) + W[j-16];
- u32bit A = digest[0], B = digest[1], C = digest[2],
- D = digest[3], E = digest[4], F = digest[5],
- G = digest[6], H = digest[7];
-
F1(A, B, C, D, E, F, G, H, W[ 0], 0x428A2F98);
F1(H, A, B, C, D, E, F, G, W[ 1], 0x71374491);
F1(G, H, A, B, C, D, E, F, W[ 2], 0xB5C0FBCF);
@@ -127,9 +127,14 @@ void SHA_224_256_BASE::compress_n(const byte input[], u32bit blocks)
F1(C, D, E, F, G, H, A, B, W[62], 0xBEF9A3F7);
F1(B, C, D, E, F, G, H, A, W[63], 0xC67178F2);
- digest[0] += A; digest[1] += B; digest[2] += C;
- digest[3] += D; digest[4] += E; digest[5] += F;
- digest[6] += G; digest[7] += H;
+ A = (digest[0] += A);
+ B = (digest[1] += B);
+ C = (digest[2] += C);
+ D = (digest[3] += D);
+ E = (digest[4] += E);
+ F = (digest[5] += F);
+ G = (digest[6] += G);
+ H = (digest[7] += H);
}
}
diff --git a/src/hash/sha2/sha2_64.cpp b/src/hash/sha2/sha2_64.cpp
index 73333af79..cafa06e53 100644
--- a/src/hash/sha2/sha2_64.cpp
+++ b/src/hash/sha2/sha2_64.cpp
@@ -47,6 +47,10 @@ inline u64bit sigma(u64bit X, u32bit rot1, u32bit rot2, u32bit shift)
*************************************************/
void SHA_384_512_BASE::compress_n(const byte input[], u32bit blocks)
{
+ u64bit A = digest[0], B = digest[1], C = digest[2],
+ D = digest[3], E = digest[4], F = digest[5],
+ G = digest[6], H = digest[7];
+
for(u32bit i = 0; i != blocks; ++i)
{
for(u32bit j = 0; j != 16; ++j)
@@ -55,96 +59,97 @@ void SHA_384_512_BASE::compress_n(const byte input[], u32bit blocks)
for(u32bit j = 16; j != 80; ++j)
W[j] = sigma(W[j- 2], 19, 61, 6) + W[j- 7] +
- sigma(W[j-15], 1, 8, 7) + W[j-16];
-
- u64bit A = digest[0], B = digest[1], C = digest[2],
- D = digest[3], E = digest[4], F = digest[5],
- G = digest[6], H = digest[7];
-
- F1(A,B,C,D,E,F,G,H,W[ 0],0x428A2F98D728AE22);
- F1(H,A,B,C,D,E,F,G,W[ 1],0x7137449123EF65CD);
- F1(G,H,A,B,C,D,E,F,W[ 2],0xB5C0FBCFEC4D3B2F);
- F1(F,G,H,A,B,C,D,E,W[ 3],0xE9B5DBA58189DBBC);
- F1(E,F,G,H,A,B,C,D,W[ 4],0x3956C25BF348B538);
- F1(D,E,F,G,H,A,B,C,W[ 5],0x59F111F1B605D019);
- F1(C,D,E,F,G,H,A,B,W[ 6],0x923F82A4AF194F9B);
- F1(B,C,D,E,F,G,H,A,W[ 7],0xAB1C5ED5DA6D8118);
- F1(A,B,C,D,E,F,G,H,W[ 8],0xD807AA98A3030242);
- F1(H,A,B,C,D,E,F,G,W[ 9],0x12835B0145706FBE);
- F1(G,H,A,B,C,D,E,F,W[10],0x243185BE4EE4B28C);
- F1(F,G,H,A,B,C,D,E,W[11],0x550C7DC3D5FFB4E2);
- F1(E,F,G,H,A,B,C,D,W[12],0x72BE5D74F27B896F);
- F1(D,E,F,G,H,A,B,C,W[13],0x80DEB1FE3B1696B1);
- F1(C,D,E,F,G,H,A,B,W[14],0x9BDC06A725C71235);
- F1(B,C,D,E,F,G,H,A,W[15],0xC19BF174CF692694);
- F1(A,B,C,D,E,F,G,H,W[16],0xE49B69C19EF14AD2);
- F1(H,A,B,C,D,E,F,G,W[17],0xEFBE4786384F25E3);
- F1(G,H,A,B,C,D,E,F,W[18],0x0FC19DC68B8CD5B5);
- F1(F,G,H,A,B,C,D,E,W[19],0x240CA1CC77AC9C65);
- F1(E,F,G,H,A,B,C,D,W[20],0x2DE92C6F592B0275);
- F1(D,E,F,G,H,A,B,C,W[21],0x4A7484AA6EA6E483);
- F1(C,D,E,F,G,H,A,B,W[22],0x5CB0A9DCBD41FBD4);
- F1(B,C,D,E,F,G,H,A,W[23],0x76F988DA831153B5);
- F1(A,B,C,D,E,F,G,H,W[24],0x983E5152EE66DFAB);
- F1(H,A,B,C,D,E,F,G,W[25],0xA831C66D2DB43210);
- F1(G,H,A,B,C,D,E,F,W[26],0xB00327C898FB213F);
- F1(F,G,H,A,B,C,D,E,W[27],0xBF597FC7BEEF0EE4);
- F1(E,F,G,H,A,B,C,D,W[28],0xC6E00BF33DA88FC2);
- F1(D,E,F,G,H,A,B,C,W[29],0xD5A79147930AA725);
- F1(C,D,E,F,G,H,A,B,W[30],0x06CA6351E003826F);
- F1(B,C,D,E,F,G,H,A,W[31],0x142929670A0E6E70);
- F1(A,B,C,D,E,F,G,H,W[32],0x27B70A8546D22FFC);
- F1(H,A,B,C,D,E,F,G,W[33],0x2E1B21385C26C926);
- F1(G,H,A,B,C,D,E,F,W[34],0x4D2C6DFC5AC42AED);
- F1(F,G,H,A,B,C,D,E,W[35],0x53380D139D95B3DF);
- F1(E,F,G,H,A,B,C,D,W[36],0x650A73548BAF63DE);
- F1(D,E,F,G,H,A,B,C,W[37],0x766A0ABB3C77B2A8);
- F1(C,D,E,F,G,H,A,B,W[38],0x81C2C92E47EDAEE6);
- F1(B,C,D,E,F,G,H,A,W[39],0x92722C851482353B);
- F1(A,B,C,D,E,F,G,H,W[40],0xA2BFE8A14CF10364);
- F1(H,A,B,C,D,E,F,G,W[41],0xA81A664BBC423001);
- F1(G,H,A,B,C,D,E,F,W[42],0xC24B8B70D0F89791);
- F1(F,G,H,A,B,C,D,E,W[43],0xC76C51A30654BE30);
- F1(E,F,G,H,A,B,C,D,W[44],0xD192E819D6EF5218);
- F1(D,E,F,G,H,A,B,C,W[45],0xD69906245565A910);
- F1(C,D,E,F,G,H,A,B,W[46],0xF40E35855771202A);
- F1(B,C,D,E,F,G,H,A,W[47],0x106AA07032BBD1B8);
- F1(A,B,C,D,E,F,G,H,W[48],0x19A4C116B8D2D0C8);
- F1(H,A,B,C,D,E,F,G,W[49],0x1E376C085141AB53);
- F1(G,H,A,B,C,D,E,F,W[50],0x2748774CDF8EEB99);
- F1(F,G,H,A,B,C,D,E,W[51],0x34B0BCB5E19B48A8);
- F1(E,F,G,H,A,B,C,D,W[52],0x391C0CB3C5C95A63);
- F1(D,E,F,G,H,A,B,C,W[53],0x4ED8AA4AE3418ACB);
- F1(C,D,E,F,G,H,A,B,W[54],0x5B9CCA4F7763E373);
- F1(B,C,D,E,F,G,H,A,W[55],0x682E6FF3D6B2B8A3);
- F1(A,B,C,D,E,F,G,H,W[56],0x748F82EE5DEFB2FC);
- F1(H,A,B,C,D,E,F,G,W[57],0x78A5636F43172F60);
- F1(G,H,A,B,C,D,E,F,W[58],0x84C87814A1F0AB72);
- F1(F,G,H,A,B,C,D,E,W[59],0x8CC702081A6439EC);
- F1(E,F,G,H,A,B,C,D,W[60],0x90BEFFFA23631E28);
- F1(D,E,F,G,H,A,B,C,W[61],0xA4506CEBDE82BDE9);
- F1(C,D,E,F,G,H,A,B,W[62],0xBEF9A3F7B2C67915);
- F1(B,C,D,E,F,G,H,A,W[63],0xC67178F2E372532B);
- F1(A,B,C,D,E,F,G,H,W[64],0xCA273ECEEA26619C);
- F1(H,A,B,C,D,E,F,G,W[65],0xD186B8C721C0C207);
- F1(G,H,A,B,C,D,E,F,W[66],0xEADA7DD6CDE0EB1E);
- F1(F,G,H,A,B,C,D,E,W[67],0xF57D4F7FEE6ED178);
- F1(E,F,G,H,A,B,C,D,W[68],0x06F067AA72176FBA);
- F1(D,E,F,G,H,A,B,C,W[69],0x0A637DC5A2C898A6);
- F1(C,D,E,F,G,H,A,B,W[70],0x113F9804BEF90DAE);
- F1(B,C,D,E,F,G,H,A,W[71],0x1B710B35131C471B);
- F1(A,B,C,D,E,F,G,H,W[72],0x28DB77F523047D84);
- F1(H,A,B,C,D,E,F,G,W[73],0x32CAAB7B40C72493);
- F1(G,H,A,B,C,D,E,F,W[74],0x3C9EBE0A15C9BEBC);
- F1(F,G,H,A,B,C,D,E,W[75],0x431D67C49C100D4C);
- F1(E,F,G,H,A,B,C,D,W[76],0x4CC5D4BECB3E42B6);
- F1(D,E,F,G,H,A,B,C,W[77],0x597F299CFC657E2A);
- F1(C,D,E,F,G,H,A,B,W[78],0x5FCB6FAB3AD6FAEC);
- F1(B,C,D,E,F,G,H,A,W[79],0x6C44198C4A475817);
-
- digest[0] += A; digest[1] += B; digest[2] += C;
- digest[3] += D; digest[4] += E; digest[5] += F;
- digest[6] += G; digest[7] += H;
+ sigma(W[j-15], 1, 8, 7) + W[j-16];
+
+ F1(A, B, C, D, E, F, G, H, W[ 0], 0x428A2F98D728AE22);
+ F1(H, A, B, C, D, E, F, G, W[ 1], 0x7137449123EF65CD);
+ F1(G, H, A, B, C, D, E, F, W[ 2], 0xB5C0FBCFEC4D3B2F);
+ F1(F, G, H, A, B, C, D, E, W[ 3], 0xE9B5DBA58189DBBC);
+ F1(E, F, G, H, A, B, C, D, W[ 4], 0x3956C25BF348B538);
+ F1(D, E, F, G, H, A, B, C, W[ 5], 0x59F111F1B605D019);
+ F1(C, D, E, F, G, H, A, B, W[ 6], 0x923F82A4AF194F9B);
+ F1(B, C, D, E, F, G, H, A, W[ 7], 0xAB1C5ED5DA6D8118);
+ F1(A, B, C, D, E, F, G, H, W[ 8], 0xD807AA98A3030242);
+ F1(H, A, B, C, D, E, F, G, W[ 9], 0x12835B0145706FBE);
+ F1(G, H, A, B, C, D, E, F, W[10], 0x243185BE4EE4B28C);
+ F1(F, G, H, A, B, C, D, E, W[11], 0x550C7DC3D5FFB4E2);
+ F1(E, F, G, H, A, B, C, D, W[12], 0x72BE5D74F27B896F);
+ F1(D, E, F, G, H, A, B, C, W[13], 0x80DEB1FE3B1696B1);
+ F1(C, D, E, F, G, H, A, B, W[14], 0x9BDC06A725C71235);
+ F1(B, C, D, E, F, G, H, A, W[15], 0xC19BF174CF692694);
+ F1(A, B, C, D, E, F, G, H, W[16], 0xE49B69C19EF14AD2);
+ F1(H, A, B, C, D, E, F, G, W[17], 0xEFBE4786384F25E3);
+ F1(G, H, A, B, C, D, E, F, W[18], 0x0FC19DC68B8CD5B5);
+ F1(F, G, H, A, B, C, D, E, W[19], 0x240CA1CC77AC9C65);
+ F1(E, F, G, H, A, B, C, D, W[20], 0x2DE92C6F592B0275);
+ F1(D, E, F, G, H, A, B, C, W[21], 0x4A7484AA6EA6E483);
+ F1(C, D, E, F, G, H, A, B, W[22], 0x5CB0A9DCBD41FBD4);
+ F1(B, C, D, E, F, G, H, A, W[23], 0x76F988DA831153B5);
+ F1(A, B, C, D, E, F, G, H, W[24], 0x983E5152EE66DFAB);
+ F1(H, A, B, C, D, E, F, G, W[25], 0xA831C66D2DB43210);
+ F1(G, H, A, B, C, D, E, F, W[26], 0xB00327C898FB213F);
+ F1(F, G, H, A, B, C, D, E, W[27], 0xBF597FC7BEEF0EE4);
+ F1(E, F, G, H, A, B, C, D, W[28], 0xC6E00BF33DA88FC2);
+ F1(D, E, F, G, H, A, B, C, W[29], 0xD5A79147930AA725);
+ F1(C, D, E, F, G, H, A, B, W[30], 0x06CA6351E003826F);
+ F1(B, C, D, E, F, G, H, A, W[31], 0x142929670A0E6E70);
+ F1(A, B, C, D, E, F, G, H, W[32], 0x27B70A8546D22FFC);
+ F1(H, A, B, C, D, E, F, G, W[33], 0x2E1B21385C26C926);
+ F1(G, H, A, B, C, D, E, F, W[34], 0x4D2C6DFC5AC42AED);
+ F1(F, G, H, A, B, C, D, E, W[35], 0x53380D139D95B3DF);
+ F1(E, F, G, H, A, B, C, D, W[36], 0x650A73548BAF63DE);
+ F1(D, E, F, G, H, A, B, C, W[37], 0x766A0ABB3C77B2A8);
+ F1(C, D, E, F, G, H, A, B, W[38], 0x81C2C92E47EDAEE6);
+ F1(B, C, D, E, F, G, H, A, W[39], 0x92722C851482353B);
+ F1(A, B, C, D, E, F, G, H, W[40], 0xA2BFE8A14CF10364);
+ F1(H, A, B, C, D, E, F, G, W[41], 0xA81A664BBC423001);
+ F1(G, H, A, B, C, D, E, F, W[42], 0xC24B8B70D0F89791);
+ F1(F, G, H, A, B, C, D, E, W[43], 0xC76C51A30654BE30);
+ F1(E, F, G, H, A, B, C, D, W[44], 0xD192E819D6EF5218);
+ F1(D, E, F, G, H, A, B, C, W[45], 0xD69906245565A910);
+ F1(C, D, E, F, G, H, A, B, W[46], 0xF40E35855771202A);
+ F1(B, C, D, E, F, G, H, A, W[47], 0x106AA07032BBD1B8);
+ F1(A, B, C, D, E, F, G, H, W[48], 0x19A4C116B8D2D0C8);
+ F1(H, A, B, C, D, E, F, G, W[49], 0x1E376C085141AB53);
+ F1(G, H, A, B, C, D, E, F, W[50], 0x2748774CDF8EEB99);
+ F1(F, G, H, A, B, C, D, E, W[51], 0x34B0BCB5E19B48A8);
+ F1(E, F, G, H, A, B, C, D, W[52], 0x391C0CB3C5C95A63);
+ F1(D, E, F, G, H, A, B, C, W[53], 0x4ED8AA4AE3418ACB);
+ F1(C, D, E, F, G, H, A, B, W[54], 0x5B9CCA4F7763E373);
+ F1(B, C, D, E, F, G, H, A, W[55], 0x682E6FF3D6B2B8A3);
+ F1(A, B, C, D, E, F, G, H, W[56], 0x748F82EE5DEFB2FC);
+ F1(H, A, B, C, D, E, F, G, W[57], 0x78A5636F43172F60);
+ F1(G, H, A, B, C, D, E, F, W[58], 0x84C87814A1F0AB72);
+ F1(F, G, H, A, B, C, D, E, W[59], 0x8CC702081A6439EC);
+ F1(E, F, G, H, A, B, C, D, W[60], 0x90BEFFFA23631E28);
+ F1(D, E, F, G, H, A, B, C, W[61], 0xA4506CEBDE82BDE9);
+ F1(C, D, E, F, G, H, A, B, W[62], 0xBEF9A3F7B2C67915);
+ F1(B, C, D, E, F, G, H, A, W[63], 0xC67178F2E372532B);
+ F1(A, B, C, D, E, F, G, H, W[64], 0xCA273ECEEA26619C);
+ F1(H, A, B, C, D, E, F, G, W[65], 0xD186B8C721C0C207);
+ F1(G, H, A, B, C, D, E, F, W[66], 0xEADA7DD6CDE0EB1E);
+ F1(F, G, H, A, B, C, D, E, W[67], 0xF57D4F7FEE6ED178);
+ F1(E, F, G, H, A, B, C, D, W[68], 0x06F067AA72176FBA);
+ F1(D, E, F, G, H, A, B, C, W[69], 0x0A637DC5A2C898A6);
+ F1(C, D, E, F, G, H, A, B, W[70], 0x113F9804BEF90DAE);
+ F1(B, C, D, E, F, G, H, A, W[71], 0x1B710B35131C471B);
+ F1(A, B, C, D, E, F, G, H, W[72], 0x28DB77F523047D84);
+ F1(H, A, B, C, D, E, F, G, W[73], 0x32CAAB7B40C72493);
+ F1(G, H, A, B, C, D, E, F, W[74], 0x3C9EBE0A15C9BEBC);
+ F1(F, G, H, A, B, C, D, E, W[75], 0x431D67C49C100D4C);
+ F1(E, F, G, H, A, B, C, D, W[76], 0x4CC5D4BECB3E42B6);
+ F1(D, E, F, G, H, A, B, C, W[77], 0x597F299CFC657E2A);
+ F1(C, D, E, F, G, H, A, B, W[78], 0x5FCB6FAB3AD6FAEC);
+ F1(B, C, D, E, F, G, H, A, W[79], 0x6C44198C4A475817);
+
+ A = (digest[0] += A);
+ B = (digest[1] += B);
+ C = (digest[2] += C);
+ D = (digest[3] += D);
+ E = (digest[4] += E);
+ F = (digest[5] += F);
+ G = (digest[6] += G);
+ H = (digest[7] += H);
}
}
diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp
index 3ff25766a..f8042075b 100644
--- a/src/hash/tiger/tiger.cpp
+++ b/src/hash/tiger/tiger.cpp
@@ -15,14 +15,14 @@ namespace Botan {
*************************************************/
void Tiger::compress_n(const byte input[], u32bit blocks)
{
+ u64bit A = digest[0], B = digest[1], C = digest[2];
+
for(u32bit i = 0; i != blocks; ++i)
{
for(u32bit j = 0; j != 8; ++j)
X[j] = load_le<u64bit>(input, j);
input += HASH_BLOCK_SIZE;
- u64bit A = digest[0], B = digest[1], C = digest[2];
-
pass(A, B, C, X, 5); mix(X);
pass(C, A, B, X, 7); mix(X);
pass(B, C, A, X, 9);
@@ -34,7 +34,9 @@ void Tiger::compress_n(const byte input[], u32bit blocks)
u64bit T = A; A = C; C = B; B = T;
}
- digest[0] ^= A; digest[1] = B - digest[1]; digest[2] += C;
+ A = (digest[0] ^= A);
+ B = digest[1] = B - digest[1];
+ C = (digest[2] += C);
}
}