From 67aa2bc321efd1f99ebfd743ca0284f9e99db42a Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 11 Dec 2010 15:42:40 +0000 Subject: Single update for padding bytes --- src/hash/keccak/keccak.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/hash/keccak') 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) -- cgit v1.2.3