Botan 3.8.1
Crypto and TLS for C&
Botan::MerkleDamgard_Hash< MD > Class Template Referencefinal

#include <mdx_hash.h>

Public Member Functions

void clear ()
 
void final (std::span< uint8_t > output)
 
 MerkleDamgard_Hash ()
 
void update (std::span< const uint8_t > input)
 

Detailed Description

template<md_hash_implementation MD>
class Botan::MerkleDamgard_Hash< MD >

Definition at line 40 of file mdx_hash.h.

Constructor & Destructor Documentation

◆ MerkleDamgard_Hash()

template<md_hash_implementation MD>
Botan::MerkleDamgard_Hash< MD >::MerkleDamgard_Hash ( )
inline

Definition at line 42 of file mdx_hash.h.

42{ clear(); }

References clear().

Member Function Documentation

◆ clear()

template<md_hash_implementation MD>
void Botan::MerkleDamgard_Hash< MD >::clear ( )
inline

Definition at line 70 of file mdx_hash.h.

70 {
71 MD::init(m_digest);
72 m_buffer.clear();
73 m_count = 0;
74 }

Referenced by final(), and MerkleDamgard_Hash().

◆ final()

template<md_hash_implementation MD>
void Botan::MerkleDamgard_Hash< MD >::final ( std::span< uint8_t > output)
inline

Definition at line 63 of file mdx_hash.h.

63 {
64 append_padding_bit();
65 append_counter_and_finalize();
66 copy_output(output);
67 clear();
68 }

References clear().

◆ update()

template<md_hash_implementation MD>
void Botan::MerkleDamgard_Hash< MD >::update ( std::span< const uint8_t > input)
inline

Definition at line 44 of file mdx_hash.h.

44 {
46
47 while(!in.empty()) {
48 if(const auto one_block = m_buffer.handle_unaligned_data(in)) {
49 MD::compress_n(m_digest, one_block.value(), 1);
50 }
51
52 if(m_buffer.in_alignment()) {
53 const auto [aligned_data, full_blocks] = m_buffer.aligned_data_to_process(in);
54 if(full_blocks > 0) {
56 }
57 }
58 }
59
60 m_count += input.size();
61 }

References Botan::BufferSlicer::empty().


The documentation for this class was generated from the following file: