diff options
author | lloyd <[email protected]> | 2008-11-08 23:02:17 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-08 23:02:17 +0000 |
commit | 33b52f8ff1663f0a20edc824331fa9c22c7a2a11 (patch) | |
tree | fabf9e62a2baf884de4716a1060213cba489b451 /src/hash/par_hash/par_hash.cpp | |
parent | 5e79ee8939aa3cfcaed9159168153ee020ebd8de (diff) |
Remove lookup from parallel hash construction
Diffstat (limited to 'src/hash/par_hash/par_hash.cpp')
-rw-r--r-- | src/hash/par_hash/par_hash.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp index 12786523f..67c4799ee 100644 --- a/src/hash/par_hash/par_hash.cpp +++ b/src/hash/par_hash/par_hash.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/par_hash.h> -#include <botan/lookup.h> namespace Botan { @@ -13,11 +12,13 @@ namespace { /************************************************* * Return the sum of the hash sizes * *************************************************/ -u32bit sum_of_hash_lengths(const std::vector<std::string>& names) +u32bit sum_of_hash_lengths(const std::vector<HashFunction*>& hashes) { u32bit sum = 0; - for(u32bit j = 0; j != names.size(); ++j) - sum += output_length_of(names[j]); + + for(u32bit j = 0; j != hashes.size(); ++j) + sum += hashes[j]->OUTPUT_LENGTH; + return sum; } @@ -65,10 +66,10 @@ std::string Parallel::name() const *************************************************/ HashFunction* Parallel::clone() const { - std::vector<std::string> names; + std::vector<HashFunction*> hash_copies; for(u32bit j = 0; j != hashes.size(); ++j) - names.push_back(hashes[j]->name()); - return new Parallel(names); + hash_copies.push_back(hashes[j]->clone()); + return new Parallel(hash_copies); } /************************************************* @@ -83,11 +84,9 @@ void Parallel::clear() throw() /************************************************* * Parallel Constructor * *************************************************/ -Parallel::Parallel(const std::vector<std::string>& names) : - HashFunction(sum_of_hash_lengths(names)) +Parallel::Parallel(const std::vector<HashFunction*>& hash_in) : + HashFunction(sum_of_hash_lengths(hash_in)), hashes(hash_in) { - for(u32bit j = 0; j != names.size(); ++j) - hashes.push_back(get_hash(names[j])); } /************************************************* |