8#include <botan/stream_cipher.h>
10#include <botan/exceptn.h>
11#include <botan/internal/scan_name.h>
13#if defined(BOTAN_HAS_CHACHA)
14 #include <botan/internal/chacha.h>
17#if defined(BOTAN_HAS_SALSA20)
18 #include <botan/internal/salsa20.h>
21#if defined(BOTAN_HAS_SHAKE_CIPHER)
22 #include <botan/internal/shake_cipher.h>
25#if defined(BOTAN_HAS_CTR_BE)
26 #include <botan/internal/ctr.h>
29#if defined(BOTAN_HAS_OFB)
30 #include <botan/internal/ofb.h>
33#if defined(BOTAN_HAS_RC4)
34 #include <botan/internal/rc4.h>
40#if defined(BOTAN_HAS_SHAKE_CIPHER)
41 if(algo_spec ==
"SHAKE-128" || algo_spec ==
"SHAKE-128-XOF") {
43 return std::make_unique<SHAKE_128_Cipher>();
47 if(algo_spec ==
"SHAKE-256" || algo_spec ==
"SHAKE-256-XOF") {
49 return std::make_unique<SHAKE_256_Cipher>();
54#if defined(BOTAN_HAS_CHACHA)
55 if(algo_spec ==
"ChaCha20") {
57 return std::make_unique<ChaCha>(20);
62#if defined(BOTAN_HAS_SALSA20)
63 if(algo_spec ==
"Salsa20") {
65 return std::make_unique<Salsa20>();
72#if defined(BOTAN_HAS_CTR_BE)
78 return std::make_unique<CTR_BE>(std::move(
cipher), ctr_size);
84#if defined(BOTAN_HAS_CHACHA)
92#if defined(BOTAN_HAS_OFB)
96 return std::make_unique<OFB>(std::move(
cipher));
102#if defined(BOTAN_HAS_RC4)
108 return std::make_unique<RC4>(skip);
129 return probe_providers_of<StreamCipher>(algo_spec);
static std::unique_ptr< BlockCipher > create(std::string_view algo_spec, std::string_view provider="")
std::string arg(size_t i) const
const std::string algo_name() const
size_t arg_as_integer(size_t i, size_t def_value) const
bool arg_count_between(size_t lower, size_t upper) const
static std::unique_ptr< StreamCipher > create_or_throw(std::string_view algo_spec, std::string_view provider="")
static std::unique_ptr< StreamCipher > create(std::string_view algo_spec, std::string_view provider="")
virtual size_t default_iv_length() const
static std::vector< std::string > providers(std::string_view algo_spec)
void cipher(const uint8_t in[], uint8_t out[], size_t len)
virtual std::string provider() const