From c6e8a61b8b7dac8ac33bf12a4b9a0b510232da83 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 12 Feb 2019 19:51:37 -0500 Subject: Add SHAKE-128 and SHAKE-256 (GH #805, PR #806) --- keccak.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'keccak.cpp') diff --git a/keccak.cpp b/keccak.cpp index 2cfff8fd..ed69590e 100644 --- a/keccak.cpp +++ b/keccak.cpp @@ -19,10 +19,12 @@ http://creativecommons.org/publicdomain/zero/1.0/ #include "pch.h" #include "keccak.h" -#include "keccakc.h" NAMESPACE_BEGIN(CryptoPP) +// The Keccak core function +extern void KeccakF1600(word64 *state); + void Keccak::Update(const byte *input, size_t length) { CRYPTOPP_ASSERT(!(input == NULLPTR && length != 0)); @@ -52,13 +54,13 @@ void Keccak::Restart() void Keccak::TruncatedFinal(byte *hash, size_t size) { - CRYPTOPP_ASSERT(hash != NULLPTR); + CRYPTOPP_ASSERT(hash != NULLPTR); ThrowIfInvalidTruncatedSize(size); - m_state.BytePtr()[m_counter] ^= 1; + m_state.BytePtr()[m_counter] ^= 0x01; m_state.BytePtr()[r()-1] ^= 0x80; KeccakF1600(m_state); - memcpy(hash, m_state, size); + std::memcpy(hash, m_state, size); Restart(); } -- cgit v1.2.1