moved BlockSize() into child classes
moved the BlockkSize() function into the child classes and made it return the BLOCKSIZE value to enhance speedpull/280/head
parent
8779c8cd78
commit
51466b5b24
6
keccak.h
6
keccak.h
|
|
@ -56,7 +56,7 @@ public:
|
|||
void Restart();
|
||||
void TruncatedFinal(byte *hash, size_t size);
|
||||
|
||||
unsigned int BlockSize() const { return r(); }
|
||||
//unsigned int BlockSize() const { return r(); } // that's the idea behind it
|
||||
|
||||
protected:
|
||||
inline unsigned int r() const {return 200 - 2 * m_digestSize;}
|
||||
|
|
@ -77,6 +77,7 @@ public:
|
|||
//! \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
|
||||
|
|
@ -94,6 +95,7 @@ public:
|
|||
//! \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
|
||||
|
|
@ -111,6 +113,7 @@ public:
|
|||
//! \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
|
||||
|
|
@ -128,6 +131,7 @@ public:
|
|||
//! \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
|
||||
|
|
|
|||
6
sha3.h
6
sha3.h
|
|
@ -42,7 +42,7 @@ public:
|
|||
void Restart();
|
||||
void TruncatedFinal(byte *hash, size_t size);
|
||||
|
||||
unsigned int BlockSize() const { return r(); }
|
||||
// unsigned int BlockSize() const { return r(); } // that's the idea behind it
|
||||
protected:
|
||||
inline unsigned int r() const {return 200 - 2 * m_digestSize;}
|
||||
|
||||
|
|
@ -62,6 +62,7 @@ public:
|
|||
//! \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
|
||||
|
|
@ -79,6 +80,7 @@ public:
|
|||
//! \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
|
||||
|
|
@ -96,6 +98,7 @@ public:
|
|||
//! \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
|
||||
|
|
@ -113,6 +116,7 @@ public:
|
|||
//! \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
|
||||
|
|
|
|||
Loading…
Reference in New Issue