Botan 3.3.0
Crypto and TLS for C&
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
14namespace Botan {
15
16/**
17* Parallel Hashes
18*/
19class Parallel final : public HashFunction {
20 public:
21 void clear() override;
22 std::string name() const override;
23 std::unique_ptr<HashFunction> new_object() const override;
24 std::unique_ptr<HashFunction> copy_state() const override;
25
26 size_t output_length() const override;
27
28 /**
29 * @param hashes a set of hashes to compute in parallel
30 * Takes ownership of all pointers
31 */
32 explicit Parallel(std::vector<std::unique_ptr<HashFunction>>& hashes);
33
34 Parallel(const Parallel&) = delete;
35 Parallel& operator=(const Parallel&) = delete;
36
37 private:
38 void add_data(std::span<const uint8_t>) override;
39 void final_result(std::span<uint8_t>) override;
40
41 std::vector<std::unique_ptr<HashFunction>> m_hashes;
42};
43
44} // namespace Botan
45
46#endif
Parallel(const Parallel &)=delete
std::unique_ptr< HashFunction > new_object() const override
Definition par_hash.cpp:55
void clear() override
Definition par_hash.cpp:77
std::string name() const override
Definition par_hash.cpp:38
Parallel & operator=(const Parallel &)=delete
std::unique_ptr< HashFunction > copy_state() const override
Definition par_hash.cpp:66
Parallel(std::vector< std::unique_ptr< HashFunction > > &hashes)
Definition par_hash.cpp:83
size_t output_length() const override
Definition par_hash.cpp:29
int(* final)(unsigned char *, CTX *)