summaryrefslogtreecommitdiff
path: root/sha3.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 /sha3.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 'sha3.h')
-rw-r--r--sha3.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sha3.h b/sha3.h
index 4f763f26..f2d3b742 100644
--- a/sha3.h
+++ b/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