aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/par_hash
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash/par_hash')
-rw-r--r--src/hash/par_hash/par_hash.cpp30
-rw-r--r--src/hash/par_hash/par_hash.h2
2 files changed, 14 insertions, 18 deletions
diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp
index aef5f8247..328be6a11 100644
--- a/src/hash/par_hash/par_hash.cpp
+++ b/src/hash/par_hash/par_hash.cpp
@@ -9,23 +9,6 @@
namespace Botan {
-namespace {
-
-/*
-* Return the sum of the hash sizes
-*/
-size_t sum_of_hash_lengths(const std::vector<HashFunction*>& hashes)
- {
- size_t sum = 0;
-
- for(size_t i = 0; i != hashes.size(); ++i)
- sum += hashes[i]->output_length();
-
- return sum;
- }
-
-}
-
/*
* Update the hash
*/
@@ -49,6 +32,17 @@ void Parallel::final_result(byte hash[])
}
/*
+* Return output size
+*/
+size_t Parallel::output_length() const
+ {
+ size_t sum = 0;
+ for(size_t i = 0; i != hashes.size(); ++i)
+ sum += hashes[i]->output_length();
+ return sum;
+ }
+
+/*
* Return the name of this type
*/
std::string Parallel::name() const
@@ -87,7 +81,7 @@ void Parallel::clear()
* Parallel Constructor
*/
Parallel::Parallel(const std::vector<HashFunction*>& hash_in) :
- HashFunction(sum_of_hash_lengths(hash_in)), hashes(hash_in)
+ hashes(hash_in)
{
}
diff --git a/src/hash/par_hash/par_hash.h b/src/hash/par_hash/par_hash.h
index 35154dde4..4f5395c23 100644
--- a/src/hash/par_hash/par_hash.h
+++ b/src/hash/par_hash/par_hash.h
@@ -23,6 +23,8 @@ class BOTAN_DLL Parallel : public HashFunction
std::string name() const;
HashFunction* clone() const;
+ size_t output_length() const;
+
/**
* @param hashes a set of hashes to compute in parallel
*/