Template Class ChaCha
Defined in File chacha.hpp
Class Documentation
-
template<std::uint8_t R = 20>
class ChaCha Public Types
-
using result_type = std::uint64_t
-
using input_word = std::uint64_t
-
using matrix_word = std::uint32_t
-
using matrix_type = std::array<matrix_word, MATRIX_WORDCOUNT>
-
using result_cache_type = std::array<result_type, MATRIX_WORDCOUNT / 2>
Public Functions
-
inline explicit ChaCha(const std::array<matrix_word, KEY_WORDCOUNT> key, const input_word counter, const input_word nonce) noexcept
Construct a scalar ChaCha generator with given key, counter and nonce.
- Parameters:
key – A 256-bit key, divided up into eight 32-bit words.
counter – Initial value of the counter.
nonce – Initial value of the nonce.
- inline constexpr result_type (operator())() noexcept
Generates the next 64-bit output.
- Returns:
The next 64-bit output.
-
inline constexpr double uniform() noexcept
Generates a uniform random number in the range [0, 1).
- Returns:
A uniform random number.
-
inline constexpr matrix_type block() noexcept
Generates the next 64-byte ChaCha block.
- Returns:
The next 64-byte ChaCha block.
-
inline constexpr matrix_type getState() const noexcept
Returns the state of the generator; a 4x4 matrix.
- Returns:
State of the generator.
Public Static Functions
- static inline constexpr auto() min () noexcept
- static inline constexpr auto() max () noexcept
Protected Static Attributes
-
static constexpr auto MATRIX_WORDCOUNT = std::uint8_t{16}
-
static constexpr auto KEY_WORDCOUNT = std::uint8_t{8}
-
using result_type = std::uint64_t