diff options
author | Jack Lloyd <[email protected]> | 2016-10-24 12:37:35 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-24 12:37:35 -0400 |
commit | c7e76399055c792b84071f22c490906576bd4027 (patch) | |
tree | 1e70ece726c42755573b876eae9b060337ef0e80 /src/lib/hash/hash.h | |
parent | de54f69aa74d98664fb13b0097f61e17322bca04 (diff) | |
parent | 331f7d28de21170e74febae53a7f49732ad40256 (diff) |
Merge GH #668: Remove Algo_Registry and associated global locks
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. |