summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2015-10-11 17:00:36 +0000
committerbrian m. carlson <sandals@crustytoothpaste.net>2015-10-11 17:00:36 +0000
commit47b6d712a3e023fdcbcaae46ee4d1949fe00c307 (patch)
treebca79200c27e9ee6f549ab9dbbc1b54a5a1ab36a
parent6c3c33be65d361fb70d6000606114f95aa5e4f6d (diff)
keccak: simplify copying data for final digest.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
-rw-r--r--impl/hash/keccak/keccak.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/impl/hash/keccak/keccak.cc b/impl/hash/keccak/keccak.cc
index e67194d..e71add2 100644
--- a/impl/hash/keccak/keccak.cc
+++ b/impl/hash/keccak/keccak.cc
@@ -847,9 +847,8 @@ void drew::KeccakCompact::GetDigest(uint8_t *digest, size_t len,
uint8_t *d = digest;
for (size_t i = 0; i < len; i += m_r, d += m_r) {
uint64_t b[1600/64];
- for (size_t y = 0; y < DivideAndRoundUp(nwords, 5); y++)
- for (size_t x = 0; x < 5 && (x+(5*y)) < nwords; x++)
- b[x + (5*y)] = m_hash[x+5*y];
+ for (size_t j = 0; j < nwords; j++)
+ b[j] = m_hash[j];
b[1+5*0] = ~b[1+5*0];
b[2+5*0] = ~b[2+5*0];
b[3+5*1] = ~b[3+5*1];