Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

rc4.h
Go to the documentation of this file.
1 /*
2 * RC4
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_RC4_H_
9 #define BOTAN_RC4_H_
10
11 #include <botan/stream_cipher.h>
12 #include <botan/types.h>
13
14 BOTAN_FUTURE_INTERNAL_HEADER(rc4.h)
15
16 namespace Botan {
17
18 /**
19 * RC4 stream cipher
20 */
21 class BOTAN_PUBLIC_API(2,0) RC4 final : public StreamCipher
22 {
23 public:
24 void cipher(const uint8_t in[], uint8_t out[], size_t length) override;
25
26 void set_iv(const uint8_t iv[], size_t iv_len) override;
27
28 void clear() override;
29 std::string name() const override;
30
31 StreamCipher* clone() const override;
32
33 Key_Length_Specification key_spec() const override;
34
35 /**
36 * @param skip skip this many initial bytes in the keystream
37 */
38 explicit RC4(size_t skip = 0);
39
40 ~RC4() { clear(); }
41
42 void seek(uint64_t offset) override;
43 private:
44 void key_schedule(const uint8_t[], size_t) override;
45 void generate();
46
47 const size_t m_SKIP;
48 uint8_t m_X = 0;
49 uint8_t m_Y = 0;
50 secure_vector<uint8_t> m_state;
51 secure_vector<uint8_t> m_buffer;
52 size_t m_position = 0;
53 };
54
55 }
56
57 #endif
Botan::Key_Length_Specification
Definition: key_spec.h:18
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:28
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan::StreamCipher::cipher
virtual void cipher(const uint8_t in[], uint8_t out[], size_t len)=0
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Botan::SymmetricAlgorithm::name
virtual std::string name() const =0
Botan::StreamCipher
Definition: stream_cipher.h:21
Botan::SymmetricAlgorithm::clear
virtual void clear()=0
Botan::RC4
Definition: rc4.h:21
Botan::StreamCipher::seek
virtual void seek(uint64_t offset)=0
Botan
Definition: alg_id.cpp:13
Botan::SymmetricAlgorithm::key_spec
virtual Key_Length_Specification key_spec() const =0
Botan::StreamCipher::clone
virtual StreamCipher * clone() const =0
Botan::StreamCipher::set_iv
virtual void set_iv(const uint8_t iv[], size_t iv_len)=0
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:139
Botan::RC4::~RC4
~RC4()
Definition: rc4.h:40