8#include <botan/internal/par_hash.h>
10#include <botan/internal/stl_util.h>
16void Parallel::add_data(std::span<const uint8_t> input) {
17 for(
auto&& hash : m_hashes) {
22void Parallel::final_result(std::span<uint8_t> output) {
23 BufferStuffer out(output);
24 for(
auto&& hash : m_hashes) {
25 hash->final(out.next(hash->output_length()));
32 for(
auto&& hash : m_hashes) {
33 sum += hash->output_length();
39 std::ostringstream
name;
43 for(
size_t i = 0; i != m_hashes.size(); ++i) {
47 name << m_hashes[i]->name();
56 std::vector<std::unique_ptr<HashFunction>> hash_copies;
57 hash_copies.reserve(m_hashes.size());
59 for(
auto&& hash : m_hashes) {
60 hash_copies.push_back(std::unique_ptr<HashFunction>(hash->new_object()));
63 return std::make_unique<Parallel>(hash_copies);
67 std::vector<std::unique_ptr<HashFunction>> hash_new_objects;
68 hash_new_objects.reserve(m_hashes.size());
70 for(
const auto& hash : m_hashes) {
71 hash_new_objects.push_back(hash->copy_state());
74 return std::make_unique<Parallel>(hash_new_objects);
78 for(
auto&& hash : m_hashes) {
84 m_hashes.reserve(hashes.size());
85 for(
auto&& hash : hashes) {
86 m_hashes.push_back(std::move(hash));
std::unique_ptr< HashFunction > new_object() const override
std::string name() const override
std::unique_ptr< HashFunction > copy_state() const override
Parallel(std::vector< std::unique_ptr< HashFunction > > &hashes)
size_t output_length() const override