• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • 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 //! _
00013 struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8>
00014 {
00015     static const char *StaticAlgorithmName() {return "IDEA";}
00016 };
00017 
00018 /// <a href="http://www.weidai.com/scan-mirror/cs.html#IDEA">IDEA</a>
00019 class IDEA : public IDEA_Info, public BlockCipherDocumentation
00020 {
00021 public:     // made public for internal purposes
00022 #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE
00023     typedef word Word;
00024 #else
00025     typedef hword Word;
00026 #endif
00027 
00028 private:
00029     class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<IDEA_Info>
00030     {
00031     public:
00032         unsigned int OptimalDataAlignment() const {return 2;}
00033         void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00034 
00035         void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
00036 
00037     private:
00038         void EnKey(const byte *);
00039         void DeKey();
00040         FixedSizeSecBlock<Word, 6*ROUNDS+4> m_key;
00041 
00042     #ifdef IDEA_LARGECACHE
00043         static inline void LookupMUL(word &a, word b);
00044         void LookupKeyLogs();
00045         static void BuildLogTables();
00046         static bool tablesBuilt;
00047         static word16 log[0x10000], antilog[0x10000];
00048     #endif
00049     };
00050 
00051 public:
00052     typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
00053     typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
00054 };
00055 
00056 typedef IDEA::Encryption IDEAEncryption;
00057 typedef IDEA::Decryption IDEADecryption;
00058 
00059 NAMESPACE_END
00060 
00061 #endif

Generated on Tue Jun 30 2015 19:07:04 for Crypto++ by  doxygen 1.7.1