summaryrefslogtreecommitdiff
path: root/keccak.h
diff options
context:
space:
mode:
authorDevJPM <jean-pierre.muench@web.de>2016-09-20 00:48:02 +0200
committerDevJPM <jean-pierre.muench@web.de>2016-09-20 00:48:02 +0200
commit51466b5b24c216d3e7a45f34df4c3d8167911ec0 (patch)
tree2a6fa11d6f8e770ef88dbd8bf5506fd0b1f49f59 /keccak.h
parent8779c8cd780eada03eedd6e68280421e62a81554 (diff)
downloadcryptopp-git-51466b5b24c216d3e7a45f34df4c3d8167911ec0.tar.gz
moved BlockSize() into child classes
moved the BlockkSize() function into the child classes and made it return the BLOCKSIZE value to enhance speed
Diffstat (limited to 'keccak.h')
-rw-r--r--keccak.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/keccak.h b/keccak.h
index 4bee18f4..0349b464 100644
--- a/keccak.h
+++ b/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