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
14namespace Botan {
15
16/**
17* Alleged RC4
18*/
19class 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
StreamCipher * clone() const
Definition arc4.h:27
~ARC4()
Definition arc4.h:39
void clear()
Definition arc4.cpp:94
void cipher(const byte in[], byte out[], size_t length)
Definition arc4.cpp:17
Key_Length_Specification key_spec() const
Definition arc4.h:29
std::string name() const
Definition arc4.cpp:84
ARC4(size_t skip=0)
Definition arc4.cpp:104