Botan  1.10.9
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 
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;
48 
49  SecureVector<byte> buffer;
50  size_t position;
51  };
52 
53 }
54 
55 #endif
Key_Length_Specification key_spec() const
Definition: arc4.h:29
unsigned char byte
Definition: types.h:22
RC4_KEY state
Definition: ossl_arc4.cpp:39
~ARC4()
Definition: arc4.h:39
const size_t SKIP
Definition: ossl_arc4.cpp:38
StreamCipher * clone() const
Definition: arc4.h:27