diff options
Diffstat (limited to 'src/hash/par_hash')
-rw-r--r-- | src/hash/par_hash/info.txt | 1 | ||||
-rw-r--r-- | src/hash/par_hash/par_hash.cpp | 100 | ||||
-rw-r--r-- | src/hash/par_hash/par_hash.h | 41 |
3 files changed, 0 insertions, 142 deletions
diff --git a/src/hash/par_hash/info.txt b/src/hash/par_hash/info.txt deleted file mode 100644 index 4f559b545..000000000 --- a/src/hash/par_hash/info.txt +++ /dev/null @@ -1 +0,0 @@ -define PARALLEL_HASH 20131128 diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp deleted file mode 100644 index df47780ef..000000000 --- a/src/hash/par_hash/par_hash.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -* Parallel -* (C) 1999-2009 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include <botan/par_hash.h> -#include <botan/parsing.h> - -namespace Botan { - -/* -* Update the hash -*/ -void Parallel::add_data(const byte input[], size_t length) - { - for(auto hash : hashes) - hash->update(input, length); - } - -/* -* Finalize the hash -*/ -void Parallel::final_result(byte out[]) - { - u32bit offset = 0; - - for(auto hash : hashes) - { - hash->final(out + offset); - offset += hash->output_length(); - } - } - -/* -* Return output size -*/ -size_t Parallel::output_length() const - { - size_t sum = 0; - - for(auto hash : hashes) - sum += hash->output_length(); - return sum; - } - -/* -* Return the name of this type -*/ -std::string Parallel::name() const - { - std::vector<std::string> names; - - for(auto hash : hashes) - names.push_back(hash->name()); - - return "Parallel(" + string_join(names, ',') + ")"; - } - -/* -* Return a clone of this object -*/ -HashFunction* Parallel::clone() const - { - std::vector<HashFunction*> hash_copies; - - for(auto hash : hashes) - hash_copies.push_back(hash->clone()); - - return new Parallel(hash_copies); - } - -/* -* Clear memory of sensitive data -*/ -void Parallel::clear() - { - for(auto hash : hashes) - hash->clear(); - } - -/* -* Parallel Constructor -*/ -Parallel::Parallel(const std::vector<HashFunction*>& hash_in) : - hashes(hash_in) - { - } - -/* -* Parallel Destructor -*/ -Parallel::~Parallel() - { - for(auto hash : hashes) - delete hash; - } - -} diff --git a/src/hash/par_hash/par_hash.h b/src/hash/par_hash/par_hash.h deleted file mode 100644 index 4f5395c23..000000000 --- a/src/hash/par_hash/par_hash.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Parallel Hash -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_PARALLEL_HASH_H__ -#define BOTAN_PARALLEL_HASH_H__ - -#include <botan/hash.h> -#include <vector> - -namespace Botan { - -/** -* Parallel Hashes -*/ -class BOTAN_DLL Parallel : public HashFunction - { - public: - void clear(); - std::string name() const; - HashFunction* clone() const; - - size_t output_length() const; - - /** - * @param hashes a set of hashes to compute in parallel - */ - Parallel(const std::vector<HashFunction*>& hashes); - ~Parallel(); - private: - void add_data(const byte[], size_t); - void final_result(byte[]); - std::vector<HashFunction*> hashes; - }; - -} - -#endif |