8 #include <botan/comb4p.h>
9 #include <botan/exceptn.h>
15 void comb4p_round(secure_vector<uint8_t>& out,
16 const secure_vector<uint8_t>& in,
24 h1.update(in.data(), in.size());
25 h2.update(in.data(), in.size());
27 secure_vector<uint8_t> h_buf = h1.final();
37 m_hash1(h1), m_hash2(h2)
39 if(m_hash1->name() == m_hash2->name())
42 if(m_hash1->output_length() != m_hash2->output_length())
44 m_hash1->name() +
" and " +
52 if(m_hash1->hash_block_size() == m_hash2->hash_block_size())
53 return m_hash1->hash_block_size();
72 void Comb4P::add_data(
const uint8_t input[],
size_t length)
74 m_hash1->update(input, length);
75 m_hash2->update(input, length);
78 void Comb4P::final_result(uint8_t out[])
80 secure_vector<uint8_t> h1 = m_hash1->final();
81 secure_vector<uint8_t> h2 = m_hash2->final();
87 comb4p_round(h2, h1, 1, *m_hash1, *m_hash2);
90 comb4p_round(h1, h2, 2, *m_hash1, *m_hash2);
92 copy_mem(out , h1.data(), h1.size());
93 copy_mem(out + h1.size(), h2.data(), h2.size());
void xor_buf(T out[], const T in[], size_t length)
Comb4P(HashFunction *h1, HashFunction *h2)
void copy_mem(T *out, const T *in, size_t n)
size_t hash_block_size() const override