aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/keccak/keccak.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash/keccak/keccak.cpp')
-rw-r--r--src/hash/keccak/keccak.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/hash/keccak/keccak.cpp b/src/hash/keccak/keccak.cpp
index 9ee4d2363..37fdc0d86 100644
--- a/src/hash/keccak/keccak.cpp
+++ b/src/hash/keccak/keccak.cpp
@@ -143,6 +143,23 @@ void Keccak_1600::add_data(const byte input[], size_t length)
length -= to_take;
+ while(to_take && S_pos % 8)
+ {
+ S[S_pos / 8] ^= static_cast<u64bit>(input[0]) << (8 * (S_pos % 8));
+
+ ++S_pos;
+ ++input;
+ --to_take;
+ }
+
+ while(to_take && to_take % 8 == 0)
+ {
+ S[S_pos / 8] ^= load_le<u64bit>(input, 0);
+ S_pos += 8;
+ input += 8;
+ to_take -= 8;
+ }
+
while(to_take)
{
S[S_pos / 8] ^= static_cast<u64bit>(input[0]) << (8 * (S_pos % 8));