8 #include <botan/chacha_rng.h>
28 size_t reseed_interval) :
38 size_t reseed_interval) :
39 Stateful_RNG(underlying_rng, entropy_sources, reseed_interval)
47 size_t reseed_interval) :
59 m_hmac->set_key(std::vector<uint8_t>(m_hmac->output_length(), 0x00));
60 m_chacha->set_key(m_hmac->final());
69 const uint8_t input[],
size_t input_len)
75 update(input, input_len);
78 m_chacha->write_keystream(output, output_len);
81 void ChaCha_RNG::update(
const uint8_t input[],
size_t input_len)
83 m_hmac->update(input, input_len);
84 m_chacha->set_key(m_hmac->final());
87 m_chacha->write_keystream(mac_key.data(), mac_key.size());
88 m_hmac->set_key(mac_key);
93 update(input, input_len);
void add_entropy(const uint8_t input[], size_t input_len) override
static std::unique_ptr< StreamCipher > create_or_throw(const std::string &algo_spec, const std::string &provider="")
size_t security_level() const override
std::vector< T, secure_allocator< T >> secure_vector
void randomize(uint8_t output[], size_t output_len) override
void reset_reseed_counter()
static std::unique_ptr< MessageAuthenticationCode > create_or_throw(const std::string &algo_spec, const std::string &provider="")
void randomize_with_input(uint8_t output[], size_t output_len, const uint8_t input[], size_t input_len) override