Botan
2.1.0
Crypto and TLS for C++11
Main Page
Namespaces
Classes
Files
File List
File Members
src
lib
stream
rc4
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
namespace
Botan
{
15
16
/**
17
* RC4 stream cipher
18
*/
19
class
BOTAN_DLL
RC4
final :
public
StreamCipher
20
{
21
public
:
22
void
cipher(
const
uint8_t in[], uint8_t out[],
size_t
length)
override
;
23
24
void
set_iv(
const
uint8_t iv[],
size_t
iv_len)
override
;
25
26
void
clear()
override
;
27
std::string name()
const override
;
28
29
StreamCipher
*
clone
()
const override
{
return
new
RC4
(m_SKIP); }
30
31
Key_Length_Specification
key_spec
()
const override
32
{
33
return
Key_Length_Specification
(1, 256);
34
}
35
36
/**
37
* @param skip skip this many initial bytes in the keystream
38
*/
39
explicit
RC4
(
size_t
skip = 0);
40
41
~RC4
() { clear(); }
42
43
void
seek(uint64_t offset)
override
;
44
private
:
45
void
key_schedule(
const
uint8_t[],
size_t
)
override
;
46
void
generate();
47
48
const
size_t
m_SKIP;
49
uint8_t m_X = 0;
50
uint8_t m_Y = 0;
51
secure_vector<uint8_t>
m_state;
52
secure_vector<uint8_t>
m_buffer;
53
size_t
m_position = 0;
54
};
55
56
}
57
58
#endif
Botan::RC4::key_spec
Key_Length_Specification key_spec() const override
Definition:
rc4.h:31
Botan::Key_Length_Specification
Definition:
key_spec.h:18
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition:
secmem.h:121
Botan::StreamCipher
Definition:
stream_cipher.h:19
Botan::RC4
Definition:
rc4.h:19
Botan
Definition:
alg_id.cpp:13
Botan::RC4::clone
StreamCipher * clone() const override
Definition:
rc4.h:29
Botan::RC4::~RC4
~RC4()
Definition:
rc4.h:41
Generated on Fri Aug 4 2017 19:29:39 for Botan by
1.8.9.1