aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/tiger
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-23 03:38:03 +0000
committerlloyd <[email protected]>2008-11-23 03:38:03 +0000
commita3b7eb7194b2d181a21c73f0b201de3d9a8d2785 (patch)
tree345be60212e71b6419d118abf2e4c084fcad8187 /src/hash/tiger
parent6cebada1115c54036f8e364ee6ca598af5996758 (diff)
Do a minor optimization in some of the compression functions, loading
the registers only once and carrying the values over between loop iterations.
Diffstat (limited to 'src/hash/tiger')
-rw-r--r--src/hash/tiger/tiger.cpp8
1 files changed, 5 insertions, 3 deletions
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);
}
}