aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/sha2_64
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-05-22 13:31:37 -0400
committerJack Lloyd <[email protected]>2017-05-22 13:31:37 -0400
commitf2f2fe7610f196cd4c5f51b5e588558762448d3c (patch)
tree70f0f84ea8c0659387e6726493a3065d05adcfe1 /src/lib/hash/sha2_64
parent89e6af6b94de14a4325d6f761b1bf597b6eb450f (diff)
Add HashFunction::copy_state
See GH #1037
Diffstat (limited to 'src/lib/hash/sha2_64')
-rw-r--r--src/lib/hash/sha2_64/sha2_64.cpp15
-rw-r--r--src/lib/hash/sha2_64/sha2_64.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/hash/sha2_64/sha2_64.cpp b/src/lib/hash/sha2_64/sha2_64.cpp
index 59242ee9c..8e01b6b4d 100644
--- a/src/lib/hash/sha2_64/sha2_64.cpp
+++ b/src/lib/hash/sha2_64/sha2_64.cpp
@@ -9,6 +9,21 @@
namespace Botan {
+std::unique_ptr<HashFunction> SHA_384::copy_state() const
+ {
+ return std::unique_ptr<HashFunction>(new SHA_384(*this));
+ }
+
+std::unique_ptr<HashFunction> SHA_512::copy_state() const
+ {
+ return std::unique_ptr<HashFunction>(new SHA_512(*this));
+ }
+
+std::unique_ptr<HashFunction> SHA_512_256::copy_state() const
+ {
+ return std::unique_ptr<HashFunction>(new SHA_512_256(*this));
+ }
+
namespace {
namespace SHA2_64 {
diff --git a/src/lib/hash/sha2_64/sha2_64.h b/src/lib/hash/sha2_64/sha2_64.h
index 51bdb2b77..b027c4d27 100644
--- a/src/lib/hash/sha2_64/sha2_64.h
+++ b/src/lib/hash/sha2_64/sha2_64.h
@@ -21,6 +21,7 @@ class BOTAN_DLL SHA_384 final : public MDx_HashFunction
std::string name() const override { return "SHA-384"; }
size_t output_length() const override { return 48; }
HashFunction* clone() const override { return new SHA_384; }
+ std::unique_ptr<HashFunction> copy_state() const override;
void clear() override;
@@ -42,6 +43,7 @@ class BOTAN_DLL SHA_512 final : public MDx_HashFunction
std::string name() const override { return "SHA-512"; }
size_t output_length() const override { return 64; }
HashFunction* clone() const override { return new SHA_512; }
+ std::unique_ptr<HashFunction> copy_state() const override;
void clear() override;
@@ -63,6 +65,7 @@ class BOTAN_DLL SHA_512_256 final : public MDx_HashFunction
std::string name() const override { return "SHA-512-256"; }
size_t output_length() const override { return 32; }
HashFunction* clone() const override { return new SHA_512_256; }
+ std::unique_ptr<HashFunction> copy_state() const override;
void clear() override;