1
// ---------------------------------------------------------------------------
3
// - afnix:sec module - RC4 block cipher class definition -
4
// ---------------------------------------------------------------------------
5
// - This program is free software; you can redistribute it and/or modify -
6
// - it provided that this copyright notice is kept intact. -
8
// - This program is distributed in the hope that it will be useful, but -
9
// - without any warranty; without even the implied warranty of -
10
// - merchantability or fitness for a particular purpose. In no event shall -
11
// - the copyright holder be liable for any direct, indirect, incidental or -
12
// - special damages arising in any way out of the use of this software. -
13
// ---------------------------------------------------------------------------
14
// - copyright (c) 1999-2011 amaury darsch -
15
// ---------------------------------------------------------------------------
20
#ifndef AFNIX_SERIALCIPHER_HPP
21
#include "SerialCipher.hpp"
26
/// The Rc4 class is a serial cipher class that implements the RC4
27
/// encryption algorithm. This is an original implementation that
28
/// conforms to ARC4 published specification. The cipher operates with
29
/// a serial key which can be at least 256 bytes.
30
/// @author amaury darsch
32
class Rc4 : public SerialCipher {
39
/// encode a byte into another one
40
/// @param bi the input byte
41
t_byte encode (const t_byte bi);
43
/// decode a byte into another one
44
/// @param bi the input byte
45
t_byte decode (const t_byte bi);
48
/// create a new cipher by key
49
/// @param key the cipher key
52
/// create a new cipher by key and flag
53
/// @param key the cipher key
54
/// @param rflg the reverse flag
55
Rc4 (const Key& key, const bool rflg);
57
/// destroy this cipher
60
/// @return the class name
61
String repr (void) const;
67
// make the copy constructor private
69
// make the assignment operator private
70
Rc4& operator = (const Rc4&);
73
/// create a new object in a generic way
74
/// @param argv the argument vector
75
static Object* mknew (Vector* argv);