Botan  2.6.0
Crypto and TLS for C++11
par_hash.h
Go to the documentation of this file.
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 namespace Botan {
15 
16 /**
17 * Parallel Hashes
18 */
19 class BOTAN_PUBLIC_API(2,0) Parallel final : public HashFunction
20  {
21  public:
22  void clear() override;
23  std::string name() const override;
24  HashFunction* clone() const override;
25  std::unique_ptr<HashFunction> copy_state() const override;
26 
27  size_t output_length() const override;
28 
29  /**
30  * @param hashes a set of hashes to compute in parallel
31  * Takes ownership of all pointers
32  */
33  explicit Parallel(std::vector<std::unique_ptr<HashFunction>>& hashes);
34 
35  Parallel(const Parallel&) = delete;
36  Parallel& operator=(const Parallel&) = delete;
37  private:
38  Parallel() = delete;
39 
40  void add_data(const uint8_t[], size_t) override;
41  void final_result(uint8_t[]) override;
42 
43  std::vector<std::unique_ptr<HashFunction>> m_hashes;
44  };
45 
46 }
47 
48 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: alg_id.cpp:13