Botan 1.10.17

arc4.h
Go to the documentation of this file.
1 /*
2 * ARC4
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_ARC4_H__
9 #define BOTAN_ARC4_H__
10
11 #include <botan/stream_cipher.h>
12 #include <botan/types.h>
13
14 namespace Botan {
15
16 /**
17 * Alleged RC4
18 */
19 class BOTAN_DLL ARC4 : public StreamCipher
20 {
21 public:
22 void cipher(const byte in[], byte out[], size_t length);
23
24 void clear();
25 std::string name() const;
26
27 StreamCipher* clone() const { return new ARC4(SKIP); }
28
29 Key_Length_Specification key_spec() const
30 {
31 return Key_Length_Specification(1, 256);
32 }
33
34 /**
35 * @param skip skip this many initial bytes in the keystream
36 */
37 ARC4(size_t skip = 0);
38
39 ~ARC4() { clear(); }
40 private:
41 void key_schedule(const byte[], size_t);
42 void generate();
43
44 const size_t SKIP;
45
46 byte X, Y;
47 SecureVector<byte> state;
48
49 SecureVector<byte> buffer;
50 size_t position;
51 };
52
53 }
54
55 #endif
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::ARC4
Definition: arc4.h:19
Botan::ARC4::clone
StreamCipher * clone() const
Definition: arc4.h:27
Botan::StreamCipher
Definition: stream_cipher.h:18
Botan
Definition: algo_base.h:14
Botan::ARC4::~ARC4
~ARC4()
Definition: arc4.h:39
Botan::SecureVector< byte >
Botan::ARC4::key_spec
Key_Length_Specification key_spec() const
Definition: arc4.h:29