aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash')
-rw-r--r--src/hash/keccak/keccak.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/hash/keccak/keccak.cpp b/src/hash/keccak/keccak.cpp
index 4e5d3744f..9ee4d2363 100644
--- a/src/hash/keccak/keccak.cpp
+++ b/src/hash/keccak/keccak.cpp
@@ -139,14 +139,18 @@ void Keccak_1600::add_data(const byte input[], size_t length)
while(length)
{
- const size_t consumed = std::min(length, bitrate / 8 - S_pos);
- xor_buf(reinterpret_cast<byte*>(&S[0]) + S_pos,
- input,
- consumed);
-
- input += consumed;
- length -= consumed;
- S_pos += consumed;
+ size_t to_take = std::min(length, bitrate / 8 - S_pos);
+
+ length -= to_take;
+
+ while(to_take)
+ {
+ S[S_pos / 8] ^= static_cast<u64bit>(input[0]) << (8 * (S_pos % 8));
+
+ ++S_pos;
+ ++input;
+ --to_take;
+ }
if(S_pos == bitrate / 8)
{