From 660d985e92d030f4ec0c3503bc14363825183371 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 3 Nov 2016 13:11:18 -0400 Subject: Simplify some code by using T::create_or_throw --- src/lib/misc/srp6/srp6.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/lib/misc/srp6') 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 hash_fn(HashFunction::create(hash_id)); - - if(!hash_fn) - throw Algorithm_Not_Found(hash_id); + std::unique_ptr 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& salt) { - std::unique_ptr hash_fn(HashFunction::create(hash_id)); - - if(!hash_fn) - throw Algorithm_Not_Found(hash_id); + std::unique_ptr hash_fn(HashFunction::create_or_throw(hash_id)); hash_fn->update(identifier); hash_fn->update(":"); -- cgit v1.2.3