25 explicit ChaCha(
size_t rounds = 20);
27 std::string
provider()
const override;
41 void clear()
override;
43 std::unique_ptr<StreamCipher>
new_object()
const override;
45 std::string
name()
const override;
47 void seek(uint64_t offset)
override;
54 void key_schedule(std::span<const uint8_t> key)
override;
56 void cipher_bytes(
const uint8_t in[], uint8_t out[],
size_t length)
override;
58 void generate_keystream(uint8_t out[],
size_t len)
override;
60 void set_iv_bytes(
const uint8_t iv[],
size_t iv_len)
override;
62 void initialize_state();
64 static size_t parallelism();
66 static void chacha(uint8_t output[],
size_t output_blocks, uint32_t state[16],
size_t rounds);
68#if defined(BOTAN_HAS_CHACHA_SIMD32)
69 static void chacha_simd32_x4(uint8_t output[64 * 4], uint32_t state[16],
size_t rounds);
72#if defined(BOTAN_HAS_CHACHA_AVX2)
73 static void chacha_avx2_x8(uint8_t output[64 * 8], uint32_t state[16],
size_t rounds);
76#if defined(BOTAN_HAS_CHACHA_AVX512)
77 static void chacha_avx512_x16(uint8_t output[64 * 16], uint32_t state[16],
size_t rounds);
84 size_t m_position = 0;