diff options
author | Jack Lloyd <[email protected]> | 2017-05-22 13:31:37 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-05-22 13:31:37 -0400 |
commit | f2f2fe7610f196cd4c5f51b5e588558762448d3c (patch) | |
tree | 70f0f84ea8c0659387e6726493a3065d05adcfe1 /src/lib/hash/blake2 | |
parent | 89e6af6b94de14a4325d6f761b1bf597b6eb450f (diff) |
Add HashFunction::copy_state
See GH #1037
Diffstat (limited to 'src/lib/hash/blake2')
-rw-r--r-- | src/lib/hash/blake2/blake2b.cpp | 5 | ||||
-rw-r--r-- | src/lib/hash/blake2/blake2b.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/hash/blake2/blake2b.cpp b/src/lib/hash/blake2/blake2b.cpp index b478af106..85171b16b 100644 --- a/src/lib/hash/blake2/blake2b.cpp +++ b/src/lib/hash/blake2/blake2b.cpp @@ -208,6 +208,11 @@ HashFunction* Blake2b::clone() const return new Blake2b(m_output_bits); } +std::unique_ptr<HashFunction> Blake2b::copy_state() const + { + return std::unique_ptr<HashFunction>(new Blake2b(*this)); + } + void Blake2b::clear() { zeroise(m_H); diff --git a/src/lib/hash/blake2/blake2b.h b/src/lib/hash/blake2/blake2b.h index 473352174..c7ceac01e 100644 --- a/src/lib/hash/blake2/blake2b.h +++ b/src/lib/hash/blake2/blake2b.h @@ -38,6 +38,8 @@ class BOTAN_DLL Blake2b final : public HashFunction std::string name() const override; void clear() override; + std::unique_ptr<HashFunction> copy_state() const override; + private: void add_data(const uint8_t input[], size_t length) override; void final_result(uint8_t out[]) override; |