00001 #ifndef CRYPTOPP_RC5_H
00002 #define CRYPTOPP_RC5_H
00003
00007 #include "cryptlib.h"
00008 #include "misc.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00013 class RC5Base : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>
00014 {
00015 public:
00016 typedef word32 RC5_WORD;
00017
00018 enum {DEFAULT_ROUNDS=16};
00019
00020 protected:
00021 RC5Base(const byte *key, unsigned int keyLen, unsigned int rounds);
00022
00023 const unsigned int r;
00024 SecBlock<RC5_WORD> sTable;
00025 };
00026
00028 class RC5Encryption : public RC5Base
00029 {
00030 public:
00031 RC5Encryption(const byte *key, unsigned int keyLen=DEFAULT_KEYLENGTH, unsigned int rounds=DEFAULT_ROUNDS)
00032 : RC5Base(key, keyLen, rounds) {}
00033
00034 void ProcessBlock(byte * inoutBlock) const
00035 {RC5Encryption::ProcessBlock(inoutBlock, inoutBlock);}
00036 void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00037 };
00038
00040 class RC5Decryption : public RC5Base
00041 {
00042 public:
00043 RC5Decryption(const byte *key, unsigned int keyLen=DEFAULT_KEYLENGTH, unsigned int rounds=DEFAULT_ROUNDS)
00044 : RC5Base(key, keyLen, rounds) {}
00045
00046 void ProcessBlock(byte * inoutBlock) const
00047 {RC5Decryption::ProcessBlock(inoutBlock, inoutBlock);}
00048 void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00049 };
00050
00051 NAMESPACE_END
00052
00053 #endif