Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

idea.h

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

Generated on Mon Apr 19 18:12:30 2004 for Crypto++ by doxygen 1.3.6-20040222