aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-12-11 15:42:40 +0000
committerlloyd <[email protected]>2010-12-11 15:42:40 +0000
commit67aa2bc321efd1f99ebfd743ca0284f9e99db42a (patch)
tree5416016fa74cfb9ea2939990e4829e88deb59447
parentd88bac8367c673615869a0f6cc32a5c06f4ad876 (diff)
Single update for padding bytes
-rw-r--r--src/hash/keccak/keccak.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/hash/keccak/keccak.cpp b/src/hash/keccak/keccak.cpp
index c1980193e..6ae92c69c 100644
--- a/src/hash/keccak/keccak.cpp
+++ b/src/hash/keccak/keccak.cpp
@@ -161,10 +161,9 @@ void Keccak_1600::add_data(const byte input[], size_t length)
void Keccak_1600::final_result(byte output[])
{
- update(0x01);
- update(diversifier);
- update(bitrate / 8);
- update(0x01);
+ const byte padding[4] = { 0x01, diversifier, bitrate / 8, 0x01 };
+
+ add_data(padding, sizeof(padding));
if(buf_pos)
for(size_t i = buf_pos; i != buffer.size(); ++i)