00001 #ifndef CRYPTOPP_IDEA_H
00002 #define CRYPTOPP_IDEA_H
00003
00007 #include "cryptlib.h"
00008 #include "misc.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00013 class IDEA : public FixedBlockSize<8>, public FixedKeyLength<16>
00014 {
00015 public:
00016 IDEA(const byte *userKey, CipherDir dir);
00017
00018 void ProcessBlock(byte * inoutBlock) const
00019 {IDEA::ProcessBlock(inoutBlock, inoutBlock);}
00020 void ProcessBlock(const byte *inBlock, byte * outBlock) const;
00021
00022 private:
00023 void EnKey(const byte *);
00024 void DeKey();
00025 SecBlock<word> key;
00026
00027 #ifdef IDEA_LARGECACHE
00028 static inline void LookupMUL(word &a, word b);
00029 void LookupKeyLogs();
00030 static void BuildLogTables();
00031 static bool tablesBuilt;
00032 static word16 log[0x10000], antilog[0x10000];
00033 #endif
00034 };
00035
00037 class IDEAEncryption : public IDEA
00038 {
00039 public:
00040 IDEAEncryption(const byte * userKey, unsigned int = 0)
00041 : IDEA (userKey, ENCRYPTION) {}
00042 };
00043
00045 class IDEADecryption : public IDEA
00046 {
00047 public:
00048 IDEADecryption(const byte * userKey, unsigned int = 0)
00049 : IDEA (userKey, DECRYPTION) {}
00050 };
00051
00052 NAMESPACE_END
00053
00054 #endif