1 /*
2 * Parallel Hash
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_PARALLEL_HASH_H_
9 #define BOTAN_PARALLEL_HASH_H_
10 
11 #include <botan/hash.h>
12 #include <vector>
13 
14 BOTAN_FUTURE_INTERNAL_HEADER(par_hash.h)
15 
16 namespace Botan {
17 
18 /**
19 * Parallel Hashes
20 */
21 class BOTAN_PUBLIC_API(2,0) Parallel final : public HashFunction
22    {
23    public:
24       void clear() override;
25       std::string name() const override;
26       HashFunction* clone() const override;
27       std::unique_ptr<HashFunction> copy_state() const override;
28 
29       size_t output_length() const override;
30 
31       /**
32       * @param hashes a set of hashes to compute in parallel
33       * Takes ownership of all pointers
34       */
35       explicit Parallel(std::vector<std::unique_ptr<HashFunction>>& hashes);
36 
37       Parallel(const Parallel&) = delete;
38       Parallel& operator=(const Parallel&) = delete;
39    private:
40       Parallel() = delete;
41 
42       void add_data(const uint8_t[], size_t) override;
43       void final_result(uint8_t[]) override;
44 
45       std::vector<std::unique_ptr<HashFunction>> m_hashes;
46    };
47 
48 }
49 
50 #endif
51