diff options
author | Jack Lloyd <[email protected]> | 2016-10-11 13:00:57 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-21 16:53:16 -0400 |
commit | 558808900bffc3c48da5e6d79ba602e88e619154 (patch) | |
tree | fd76ee2d009c2b707d888683cbd767351c4ff6b3 /src/lib/hash/hash.h | |
parent | 6aa855bba613c7b6fedfbe71d15930964acb1633 (diff) |
Remove Algo_Registry
I repent my use of global constructors.
I repent my use of global locks.
Hopefully I will never touch this code again.
:)
Diffstat (limited to 'src/lib/hash/hash.h')
-rw-r--r-- | src/lib/hash/hash.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/hash/hash.h b/src/lib/hash/hash.h index 206333b9f..f6cf470cb 100644 --- a/src/lib/hash/hash.h +++ b/src/lib/hash/hash.h @@ -8,7 +8,6 @@ #ifndef BOTAN_HASH_FUNCTION_BASE_CLASS_H__ #define BOTAN_HASH_FUNCTION_BASE_CLASS_H__ -#include <botan/scan_name.h> #include <botan/buf_comp.h> #include <string> @@ -20,17 +19,25 @@ namespace Botan { class BOTAN_DLL HashFunction : public Buffered_Computation { public: - typedef SCAN_Name Spec; + /** + * Create an instance based on a name, or return null if the + * algo/provider combination cannot be found. If provider is + * empty then best available is chosen. + */ + static std::unique_ptr<HashFunction> + create(const std::string& algo_spec, + const std::string& provider = ""); /** * Create an instance based on a name * If provider is empty then best available is chosen. * @param algo_spec algorithm name * @param provider provider implementation to use - * @return a null pointer if the algo/provider combination cannot be found + * Throws Lookup_Error if not not found. */ - static std::unique_ptr<HashFunction> create(const std::string& algo_spec, - const std::string& provider = ""); + static std::unique_ptr<HashFunction> + create_or_throw(const std::string& algo_spec, + const std::string& provider = ""); /** * @return list of available providers for this algorithm, empty if not available @@ -49,9 +56,7 @@ class BOTAN_DLL HashFunction : public Buffered_Computation */ virtual std::string provider() const { return "base"; } - HashFunction(); - - virtual ~HashFunction(); + virtual ~HashFunction() {} /** * Reset the state. |