diff options
author | lloyd <[email protected]> | 2010-12-13 16:18:38 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-12-13 16:18:38 +0000 |
commit | 9285e06b23001e2ea3a628178151047ceec8d83e (patch) | |
tree | 42b78ab41538608c5ff41cdcac47bc3c6c594d97 /src/hash/keccak | |
parent | 3560566f3993477ed8be95e7ec6817bf0db1edc3 (diff) |
Do the XOR a word at a time where possible which gets performance back
to the level of the version using xor_buf, at least on a little-endian
CPU.
Diffstat (limited to 'src/hash/keccak')
-rw-r--r-- | src/hash/keccak/keccak.cpp | 17 |
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)); |