commit
de04771aa8
22
keccak.h
22
keccak.h
|
|
@ -56,6 +56,8 @@ public:
|
|||
void Restart();
|
||||
void TruncatedFinal(byte *hash, size_t size);
|
||||
|
||||
//unsigned int BlockSize() const { return r(); } // that's the idea behind it
|
||||
|
||||
protected:
|
||||
inline unsigned int r() const {return 200 - 2 * m_digestSize;}
|
||||
|
||||
|
|
@ -70,10 +72,15 @@ class Keccak_224 : public Keccak
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 28)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a Keccak-224 message digest
|
||||
Keccak_224() : Keccak(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-224";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
//! \class Keccak_256
|
||||
|
|
@ -83,10 +90,15 @@ class Keccak_256 : public Keccak
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 32)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a Keccak-256 message digest
|
||||
Keccak_256() : Keccak(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-256";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
//! \class Keccak_384
|
||||
|
|
@ -96,10 +108,15 @@ class Keccak_384 : public Keccak
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 48)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a Keccak-384 message digest
|
||||
Keccak_384() : Keccak(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-384";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
//! \class Keccak_512
|
||||
|
|
@ -109,10 +126,15 @@ class Keccak_512 : public Keccak
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 64)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a Keccak-512 message digest
|
||||
Keccak_512() : Keccak(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-512";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
|
|
|||
21
sha3.h
21
sha3.h
|
|
@ -42,6 +42,7 @@ public:
|
|||
void Restart();
|
||||
void TruncatedFinal(byte *hash, size_t size);
|
||||
|
||||
// unsigned int BlockSize() const { return r(); } // that's the idea behind it
|
||||
protected:
|
||||
inline unsigned int r() const {return 200 - 2 * m_digestSize;}
|
||||
|
||||
|
|
@ -56,10 +57,15 @@ class SHA3_224 : public SHA3
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 28)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a SHA3-224 message digest
|
||||
SHA3_224() : SHA3(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-224";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
//! \class SHA3_256
|
||||
|
|
@ -69,10 +75,15 @@ class SHA3_256 : public SHA3
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 32)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a SHA3-256 message digest
|
||||
SHA3_256() : SHA3(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-256";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
//! \class SHA3_384
|
||||
|
|
@ -82,10 +93,15 @@ class SHA3_384 : public SHA3
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 48)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a SHA3-384 message digest
|
||||
SHA3_384() : SHA3(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-384";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
//! \class SHA3_512
|
||||
|
|
@ -95,10 +111,15 @@ class SHA3_512 : public SHA3
|
|||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = 64)
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = 200 - 2 * DIGESTSIZE)
|
||||
|
||||
//! \brief Construct a SHA3-512 message digest
|
||||
SHA3_512() : SHA3(DIGESTSIZE) {}
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-512";}
|
||||
unsigned int BlockSize() const { return BLOCKSIZE; }
|
||||
private:
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE < 200); // ensure there was no underflow in the math
|
||||
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE > DIGESTSIZE); // this is a general expectation by HMAC
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
|
|
|||
Loading…
Reference in New Issue