00001
00002
00003
00004
00005
00006 #ifndef CRYPTOPP_RC5_H
00007 #define CRYPTOPP_RC5_H
00008
00009 #include "seckey.h"
00010 #include "secblock.h"
00011
00012 NAMESPACE_BEGIN(CryptoPP)
00013
00014
00015 struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16>
00016 {
00017 static const char *StaticAlgorithmName() {return "RC5";}
00018 typedef word32 RC5_WORD;
00019 };
00020
00021
00022 class RC5 : public RC5_Info, public BlockCipherDocumentation
00023 {
00024 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<RC5_Info>
00025 {
00026 public:
00027 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms);
00028
00029 protected:
00030 unsigned int r;
00031 SecBlock<RC5_WORD> sTable;
00032 };
00033
00034 class CRYPTOPP_NO_VTABLE Enc : public Base
00035 {
00036 public:
00037 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00038 };
00039
00040 class CRYPTOPP_NO_VTABLE Dec : public Base
00041 {
00042 public:
00043 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00044 };
00045
00046 public:
00047 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
00048 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
00049 };
00050
00051 typedef RC5::Encryption RC5Encryption;
00052 typedef RC5::Decryption RC5Decryption;
00053
00054 NAMESPACE_END
00055
00056 #endif