// keccak.h - written and placed in the public domain by Wei Dai //! \file keccak.h //! \brief Classes for Keccak message digests //! \details The Crypto++ Keccak implementation uses F1600 with XOF d=0x01. //! FIPS 202 conformance (XOF d=0x06) is available in SHA3 classes. //! \details Keccak will likely change in the future to accomodate extensibility of the //! round function and the XOF functions. //! \sa Keccak //! \since Crypto++ 5.6.4 #ifndef CRYPTOPP_KECCAK_H #define CRYPTOPP_KECCAK_H #include "cryptlib.h" #include "secblock.h" NAMESPACE_BEGIN(CryptoPP) //! \class Keccak //! \brief Keccak message digest base class //! \details The Crypto++ Keccak implementation uses F1600 with XOF d=0x01. //! FIPS 202 conformance (XOF d=0x06) is available in SHA3 classes. //! \details Keccak is the base class for Keccak_224, Keccak_256, Keccak_384 and Keccak_512. //! Library users should instantiate a derived class, and only use Keccak //! as a base class reference or pointer. //! \details Keccak will likely change in the future to accomodate extensibility of the //! round function and the XOF functions. //! \details Perform the following to specify a different digest size. The class will use F1600, //! XOF d=0x01, and a new vaue for r() (which will be 200-2*24 = 152). //!
Keccack_192 : public Keccack
//! {
//! public:
//! CRYPTOPP_CONSTANT(DIGESTSIZE = 24)
//! Keccack_192() : Keccack(DIGESTSIZE) {}
//! };
//!
//!
//! \sa SHA3, Keccak_224, Keccak_256, Keccak_384 and Keccak_512.
//! \since Crypto++ 5.6.4
class Keccak : public HashTransformation
{
public:
//! \brief Construct a Keccak
//! \param digestSize the digest size, in bytes
//! \details Keccak is the base class for Keccak_224, Keccak_256, Keccak_384 and Keccak_512.
//! Library users should instantiate a derived class, and only use Keccak
//! as a base class reference or pointer.
//! \since Crypto++ 5.6.4
Keccak(unsigned int digestSize) : m_digestSize(digestSize) {Restart();}
unsigned int DigestSize() const {return m_digestSize;}
std::string AlgorithmName() const {return "Keccak-" + IntToString(m_digestSize*8);}
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() { return "Keccak"; }
unsigned int OptimalDataAlignment() const {return GetAlignmentOf