00001
#ifndef CRYPTOPP_ARC4_H
00002
#define CRYPTOPP_ARC4_H
00003
00004
#include "strciphr.h"
00005
00006 NAMESPACE_BEGIN(CryptoPP)
00007
00008
00009 class CRYPTOPP_NO_VTABLE
ARC4_Base : public
VariableKeyLength<16, 1, 256>, public
RandomNumberGenerator, public
SymmetricCipher, public
SymmetricCipherDocumentation
00010 {
00011
public:
00012 ~
ARC4_Base();
00013
00014
static const char *StaticAlgorithmName() {
return "ARC4";}
00015
00016 byte GenerateByte();
00017
void DiscardBytes(
unsigned int n);
00018
00019
void ProcessData(byte *outString,
const byte *inString,
unsigned int length);
00020
00021 bool IsRandomAccess()
const {
return false;}
00022 bool IsSelfInverting()
const {
return true;}
00023 bool IsForwardTransformation()
const {
return true;}
00024
00025 typedef SymmetricCipherFinal<ARC4_Base> Encryption;
00026 typedef SymmetricCipherFinal<ARC4_Base> Decryption;
00027
00028
protected:
00029
void UncheckedSetKey(
const NameValuePairs ¶ms,
const byte *key,
unsigned int length,
const byte *iv);
00030
virtual unsigned int GetDefaultDiscardBytes()
const {
return 0;}
00031
00032 FixedSizeSecBlock<byte, 256> m_state;
00033 byte m_x, m_y;
00034 };
00035
00036
00037 DOCUMENTED_TYPEDEF(
SymmetricCipherFinal<ARC4_Base>,
ARC4)
00038
00039
00040 class CRYPTOPP_NO_VTABLE
MARC4_Base : public
ARC4_Base
00041 {
00042
public:
00043 static const char *StaticAlgorithmName() {
return "MARC4";}
00044
00045
typedef SymmetricCipherFinal<MARC4_Base> Encryption;
00046
typedef SymmetricCipherFinal<MARC4_Base> Decryption;
00047
00048
protected:
00049 unsigned int GetDefaultDiscardBytes()
const {
return 256;}
00050 };
00051
00052
00053 DOCUMENTED_TYPEDEF(
SymmetricCipherFinal<MARC4_Base>,
MARC4)
00054
00055 NAMESPACE_END
00056
00057 #endif