00001 #ifndef CRYPTOPP_RC2_H
00002 #define CRYPTOPP_RC2_H
00003
00007 #include "cryptlib.h"
00008 #include "misc.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00013 class RC2Base : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128>
00014 {
00015 public:
00016 enum {BLOCKSIZE=8};
00017 unsigned int BlockSize() const {return BLOCKSIZE;}
00018
00019 protected:
00020
00021 RC2Base(const byte *key, unsigned int keyLen, unsigned int effectiveLen);
00022
00023 SecBlock<word16> K;
00024 };
00025
00027 class RC2Encryption : public RC2Base
00028 {
00029 public:
00030 RC2Encryption(const byte *key, unsigned int keyLen=DEFAULT_KEYLENGTH, unsigned int effectiveLen=1024)
00031 : RC2Base(key, keyLen, effectiveLen) {}
00032
00033 void ProcessBlock(byte * inoutBlock) const
00034 {RC2Encryption::ProcessBlock(inoutBlock, inoutBlock);}
00035 void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00036 };
00037
00039 class RC2Decryption : public RC2Base
00040 {
00041 public:
00042 RC2Decryption(const byte *key, unsigned int keyLen=DEFAULT_KEYLENGTH, unsigned int effectiveLen=1024)
00043 : RC2Base(key, keyLen, effectiveLen) {}
00044
00045 void ProcessBlock(byte * inoutBlock) const
00046 {RC2Decryption::ProcessBlock(inoutBlock, inoutBlock);}
00047 void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00048 };
00049
00050 NAMESPACE_END
00051
00052 #endif