Template Class ChaChaSIMD

Nested Relationships

Nested Types

Class Documentation

template<std::uint8_t R = 20>
class ChaChaSIMD

ChaChaSIMD: runtime SIMD dispatch via inline union + function pointers. No heap allocation, no virtual dispatch.

Template Parameters:

R – Number of ChaCha rounds.

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 ChaChaSIMD(result_type seed, const input_word counter = 0, const input_word nonce = 0)
inline explicit ChaChaSIMD(const std::array<matrix_word, KEY_WORDCOUNT> key, const input_word counter, const input_word nonce)
inline constexpr result_type operator()() noexcept
inline constexpr double uniform() noexcept
inline constexpr matrix_type block() noexcept
inline constexpr matrix_type getState() const noexcept
inline matrix_type getStateForSerde() const noexcept
inline void setState(const matrix_type &matrix) noexcept
inline const result_cache_type &result_cache() const noexcept
inline void set_result_cache(const result_cache_type &cache) noexcept
inline std::uint8_t result_index() const noexcept
inline void set_result_index(std::uint8_t idx) noexcept
inline size_t getSIMDSize() const noexcept

Public Static Functions

static inline constexpr auto() min () noexcept
static inline constexpr auto() max () noexcept
static inline constexpr matrix_type results_to_block(const result_cache_type &results) noexcept
static inline constexpr result_cache_type block_to_results(const matrix_type &block) noexcept
static inline constexpr std::array<matrix_word, KEY_WORDCOUNT> seed_to_key(result_type seed) noexcept

Public Static Attributes

static constexpr auto MATRIX_WORDCOUNT = std::uint8_t{16}
static constexpr auto KEY_WORDCOUNT = std::uint8_t{8}