00001 #ifndef CRYPTOPP_IDEA_H
00002 #define CRYPTOPP_IDEA_H
00003
00004
00005
00006
00007 #include "seckey.h"
00008 #include "secblock.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00012
00013 struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8>
00014 {
00015 static const char *StaticAlgorithmName() {return "IDEA";}
00016 };
00017
00018
00019 class IDEA : public IDEA_Info, public BlockCipherDocumentation
00020 {
00021 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<IDEA_Info>
00022 {
00023 public:
00024 unsigned int GetAlignment() const {return 2;}
00025 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00026
00027 void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length);
00028
00029 private:
00030 void EnKey(const byte *);
00031 void DeKey();
00032 FixedSizeSecBlock<word, 6*ROUNDS+4> m_key;
00033
00034 #ifdef IDEA_LARGECACHE
00035 static inline void LookupMUL(word &a, word b);
00036 void LookupKeyLogs();
00037 static void BuildLogTables();
00038 static bool tablesBuilt;
00039 static word16 log[0x10000], antilog[0x10000];
00040 #endif
00041 };
00042
00043 public:
00044 typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
00045 typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
00046 };
00047
00048 typedef IDEA::Encryption IDEAEncryption;
00049 typedef IDEA::Decryption IDEADecryption;
00050
00051 NAMESPACE_END
00052
00053 #endif