aboutsummaryrefslogtreecommitdiffstats
path: root/src/sha_64.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-05-31 03:52:41 +0000
committerlloyd <[email protected]>2007-05-31 03:52:41 +0000
commit4394619562d59ec943c49e0f2c28bf05e3489ce8 (patch)
treef44e5a4a3a78d6ae2522cc2c6ad1e8c83117c39e /src/sha_64.cpp
parent067035e42c55c2c26f996d2869727e8375c1bcf2 (diff)
Use the word-loading operations in SHA-384/SHA-512 as well
Diffstat (limited to 'src/sha_64.cpp')
-rw-r--r--src/sha_64.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/sha_64.cpp b/src/sha_64.cpp
index cf30bbbbe..233071e21 100644
--- a/src/sha_64.cpp
+++ b/src/sha_64.cpp
@@ -47,9 +47,8 @@ inline u64bit sigma(u64bit X, u32bit rot1, u32bit rot2, u32bit shift)
void SHA_64_BASE::hash(const byte input[])
{
for(u32bit j = 0; j != 16; ++j)
- W[j] = make_u64bit(input[8*j ], input[8*j+1], input[8*j+2],
- input[8*j+3], input[8*j+4], input[8*j+5],
- input[8*j+6], input[8*j+7]);
+ W[j] = load_be<u64bit>(input, j);
+
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];
@@ -149,8 +148,8 @@ void SHA_64_BASE::hash(const byte input[])
*************************************************/
void SHA_64_BASE::copy_out(byte output[])
{
- for(u32bit j = 0; j != OUTPUT_LENGTH; ++j)
- output[j] = get_byte(j % 8, digest[j/8]);
+ for(u32bit j = 0; j != OUTPUT_LENGTH; j += 8)
+ store_be(digest[j/8], output + j);
}
/*************************************************