00001 #ifndef CRYPTOPP_TEA_H
00002 #define CRYPTOPP_TEA_H
00003
00007 #include "cryptlib.h"
00008 #include "misc.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00013 class TEA : public FixedBlockSize<8>, public FixedKeyLength<16>
00014 {
00015 public:
00016 TEA(const byte *userKey);
00017
00018 enum {ROUNDS=32, LOG_ROUNDS=5};
00019
00020 protected:
00021 static const word32 DELTA;
00022 SecBlock<word32> k;
00023 };
00024
00026 class TEAEncryption : public TEA
00027 {
00028 public:
00029 TEAEncryption(const byte *userKey, unsigned int = 0)
00030 : TEA(userKey) {}
00031
00032 void ProcessBlock(byte * inoutBlock) const
00033 {TEAEncryption::ProcessBlock(inoutBlock, inoutBlock);}
00034 void ProcessBlock(const byte *inBlock, byte *outBlock) const;
00035 };
00036
00038 class TEADecryption : public TEA
00039 {
00040 public:
00041 TEADecryption(const byte *userKey, unsigned int = 0)
00042 : TEA(userKey) {}
00043
00044 void ProcessBlock(byte * inoutBlock) const
00045 {TEADecryption::ProcessBlock(inoutBlock, inoutBlock);}
00046 void ProcessBlock(const byte *inBlock, byte *outBlock) const;
00047 };
00048
00049 NAMESPACE_END
00050
00051 #endif