summaryrefslogtreecommitdiff
path: root/Libraries/LibCrypto/Hash/HashFunction.h
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibCrypto/Hash/HashFunction.h')
-rw-r--r--Libraries/LibCrypto/Hash/HashFunction.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/Libraries/LibCrypto/Hash/HashFunction.h b/Libraries/LibCrypto/Hash/HashFunction.h
index 00aedfafb5..a7e3a8ae25 100644
--- a/Libraries/LibCrypto/Hash/HashFunction.h
+++ b/Libraries/LibCrypto/Hash/HashFunction.h
@@ -31,21 +31,24 @@
#include <AK/Types.h>
namespace Crypto {
+namespace Hash {
-template<size_t BlockS, typename DigestT>
-class HashFunction {
-public:
- static constexpr auto BlockSize = BlockS;
- using DigestType = DigestT;
+ template <size_t BlockS, typename DigestT>
+ class HashFunction {
+ public:
+ static constexpr auto BlockSize = BlockS / 8;
+ static constexpr auto DigestSize = sizeof(DigestT);
- static size_t block_size() { return BlockSize; };
- static size_t digest_size() { return sizeof(DigestType); };
+ using DigestType = DigestT;
- virtual void update(const u8*, size_t) = 0;
- virtual void update(const ByteBuffer& buffer) = 0;
- virtual void update(const StringView& string) = 0;
+ static size_t block_size() { return BlockSize; };
+ static size_t digest_size() { return DigestSize; };
- virtual DigestType digest() = 0;
-};
+ virtual void update(const u8*, size_t) = 0;
+ virtual void update(const ByteBuffer& buffer) = 0;
+ virtual void update(const StringView& string) = 0;
+ virtual DigestType digest() = 0;
+ };
+}
}