diff options
author | Jack Lloyd <[email protected]> | 2019-02-22 11:07:17 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-02-22 11:07:17 -0500 |
commit | 1a837f211f8cb059b5374bdfc86a2993453661b7 (patch) | |
tree | 0c2c13761347a8e9fd0ff3ca1083a099958154ee /src/lib/hash/blake2 | |
parent | 0986b99ea81cd1c67b444e387db8f8daccc5a534 (diff) |
s/Blake2b/BLAKE2b/
As that is the proper name of the hash. Add a typedef for compat.
Diffstat (limited to 'src/lib/hash/blake2')
-rw-r--r-- | src/lib/hash/blake2/blake2b.cpp | 28 | ||||
-rw-r--r-- | src/lib/hash/blake2/blake2b.h | 10 |
2 files changed, 20 insertions, 18 deletions
diff --git a/src/lib/hash/blake2/blake2b.cpp b/src/lib/hash/blake2/blake2b.cpp index 6d897b29f..a45f058d4 100644 --- a/src/lib/hash/blake2/blake2b.cpp +++ b/src/lib/hash/blake2/blake2b.cpp @@ -1,5 +1,5 @@ /* -* Blake2b +* BLAKE2b * (C) 2016 cynecx * (C) 2017 Jack Lloyd * @@ -31,7 +31,7 @@ const uint64_t blake2b_IV[BLAKE2B_IVU64COUNT] = { } -Blake2b::Blake2b(size_t output_bits) : +BLAKE2b::BLAKE2b(size_t output_bits) : m_output_bits(output_bits), m_buffer(BLAKE2B_BLOCKBYTES), m_bufpos(0), @@ -39,13 +39,13 @@ Blake2b::Blake2b(size_t output_bits) : { if(output_bits == 0 || output_bits > 512 || output_bits % 8 != 0) { - throw Invalid_Argument("Bad output bits size for Blake2b"); + throw Invalid_Argument("Bad output bits size for BLAKE2b"); } state_init(); } -void Blake2b::state_init() +void BLAKE2b::state_init() { copy_mem(m_H.data(), blake2b_IV, BLAKE2B_IVU64COUNT); m_H[0] ^= 0x01010000 ^ static_cast<uint8_t>(output_length()); @@ -85,7 +85,7 @@ inline void ROUND(uint64_t* v, const uint64_t* M) } -void Blake2b::compress(const uint8_t* input, size_t blocks, uint64_t increment) +void BLAKE2b::compress(const uint8_t* input, size_t blocks, uint64_t increment) { for(size_t b = 0; b != blocks; ++b) { @@ -131,7 +131,7 @@ void Blake2b::compress(const uint8_t* input, size_t blocks, uint64_t increment) } } -void Blake2b::add_data(const uint8_t input[], size_t length) +void BLAKE2b::add_data(const uint8_t input[], size_t length) { if(length == 0) return; @@ -170,7 +170,7 @@ void Blake2b::add_data(const uint8_t input[], size_t length) } } -void Blake2b::final_result(uint8_t output[]) +void BLAKE2b::final_result(uint8_t output[]) { if(m_bufpos != BLAKE2B_BLOCKBYTES) clear_mem(&m_buffer[m_bufpos], BLAKE2B_BLOCKBYTES - m_bufpos); @@ -180,22 +180,22 @@ void Blake2b::final_result(uint8_t output[]) clear(); } -std::string Blake2b::name() const +std::string BLAKE2b::name() const { - return "Blake2b(" + std::to_string(m_output_bits) + ")"; + return "BLAKE2b(" + std::to_string(m_output_bits) + ")"; } -HashFunction* Blake2b::clone() const +HashFunction* BLAKE2b::clone() const { - return new Blake2b(m_output_bits); + return new BLAKE2b(m_output_bits); } -std::unique_ptr<HashFunction> Blake2b::copy_state() const +std::unique_ptr<HashFunction> BLAKE2b::copy_state() const { - return std::unique_ptr<HashFunction>(new Blake2b(*this)); + return std::unique_ptr<HashFunction>(new BLAKE2b(*this)); } -void Blake2b::clear() +void BLAKE2b::clear() { zeroise(m_H); zeroise(m_buffer); diff --git a/src/lib/hash/blake2/blake2b.h b/src/lib/hash/blake2/blake2b.h index f4a68ad55..1c47e32cc 100644 --- a/src/lib/hash/blake2/blake2b.h +++ b/src/lib/hash/blake2/blake2b.h @@ -1,5 +1,5 @@ /* -* Blake2b +* BLAKE2b * (C) 2016 cynecx * * Botan is released under the Simplified BSD License (see license.txt) @@ -17,13 +17,13 @@ namespace Botan { /** * BLAKE2B */ -class BOTAN_PUBLIC_API(2,0) Blake2b final : public HashFunction +class BOTAN_PUBLIC_API(2,0) BLAKE2b final : public HashFunction { public: /** - * @param output_bits the output size of Blake2b in bits + * @param output_bits the output size of BLAKE2b in bits */ - explicit Blake2b(size_t output_bits = 512); + explicit BLAKE2b(size_t output_bits = 512); size_t hash_block_size() const override { return 128; } size_t output_length() const override { return m_output_bits / 8; } @@ -51,6 +51,8 @@ class BOTAN_PUBLIC_API(2,0) Blake2b final : public HashFunction uint64_t m_F[2]; }; +typedef BLAKE2b Blake2b; + } #endif |