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