diff options
author | Jack Lloyd <[email protected]> | 2016-11-03 13:11:18 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-03 13:11:18 -0400 |
commit | 660d985e92d030f4ec0c3503bc14363825183371 (patch) | |
tree | 8daeec407eab8f5dc7c00f83b08fc687abe9a8d9 /src/lib/misc/srp6 | |
parent | e42d1513fd6f80dcd2ae4109fddf53b61e935116 (diff) |
Simplify some code by using T::create_or_throw
Diffstat (limited to 'src/lib/misc/srp6')
-rw-r--r-- | src/lib/misc/srp6/srp6.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/lib/misc/srp6/srp6.cpp b/src/lib/misc/srp6/srp6.cpp index 7fca6461f..f54726151 100644 --- a/src/lib/misc/srp6/srp6.cpp +++ b/src/lib/misc/srp6/srp6.cpp @@ -18,10 +18,7 @@ BigInt hash_seq(const std::string& hash_id, const BigInt& in1, const BigInt& in2) { - std::unique_ptr<HashFunction> hash_fn(HashFunction::create(hash_id)); - - if(!hash_fn) - throw Algorithm_Not_Found(hash_id); + std::unique_ptr<HashFunction> hash_fn(HashFunction::create_or_throw(hash_id)); hash_fn->update(BigInt::encode_1363(in1, pad_to)); hash_fn->update(BigInt::encode_1363(in2, pad_to)); @@ -34,10 +31,7 @@ BigInt compute_x(const std::string& hash_id, const std::string& password, const std::vector<byte>& salt) { - std::unique_ptr<HashFunction> hash_fn(HashFunction::create(hash_id)); - - if(!hash_fn) - throw Algorithm_Not_Found(hash_id); + std::unique_ptr<HashFunction> hash_fn(HashFunction::create_or_throw(hash_id)); hash_fn->update(identifier); hash_fn->update(":"); |