summaryrefslogtreecommitdiff
path: root/keccak.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-02-12 19:51:37 -0500
committerGitHub <noreply@github.com>2019-02-12 19:51:37 -0500
commitc6e8a61b8b7dac8ac33bf12a4b9a0b510232da83 (patch)
treee17f8e69cefe48982a36f44e7c062b894e23ad9a /keccak.cpp
parente499131ea6ba23ce57f6a7e50d0c2ff3fb8eff62 (diff)
downloadcryptopp-git-c6e8a61b8b7dac8ac33bf12a4b9a0b510232da83.tar.gz
Add SHAKE-128 and SHAKE-256 (GH #805, PR #806)
Diffstat (limited to 'keccak.cpp')
-rw-r--r--keccak.cpp10
1 files changed, 6 insertions, 4 deletions
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();
}