Crypto++  5.6.3
Free C++ class library of cryptographic schemes
idea.h
Go to the documentation of this file.
1 // idea.h - written and placed in the public domain by Wei Dai
2 
3 //! \file idea.h
4 //! \brief Classes for the IDEA block cipher
5 
6 #ifndef CRYPTOPP_IDEA_H
7 #define CRYPTOPP_IDEA_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 
12 NAMESPACE_BEGIN(CryptoPP)
13 
14 //! _
15 struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8>
16 {
17  static const char *StaticAlgorithmName() {return "IDEA";}
18 };
19 
20 /// <a href="http://www.weidai.com/scan-mirror/cs.html#IDEA">IDEA</a>
21 class IDEA : public IDEA_Info, public BlockCipherDocumentation
22 {
23 public: // made public for internal purposes
24 #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE
25  typedef word Word;
26 #else
27  typedef hword Word;
28 #endif
29 
30 private:
31  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<IDEA_Info>
32  {
33  public:
34  unsigned int OptimalDataAlignment() const {return 2;}
35  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
36 
37  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
38 
39  private:
40  void EnKey(const byte *);
41  void DeKey();
43 
44  #ifdef IDEA_LARGECACHE
45  static inline void LookupMUL(word &a, word b);
46  void LookupKeyLogs();
47  static void BuildLogTables();
48  static volatile bool tablesBuilt;
49  static word16 log[0x10000], antilog[0x10000];
50  #endif
51  };
52 
53 public:
56 };
57 
60 
61 NAMESPACE_END
62 
63 #endif
IDEA
Definition: idea.h:21
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:113
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:385
Classes and functions for secure memory allocations.
Inherited by block ciphers with fixed block size.
Definition: seckey.h:34
Classes and functions for implementing secret key algorithms.
Provides class member functions to key a block cipher.
Definition: seckey.h:305
Inherited by ciphers with fixed number of rounds.
Definition: seckey.h:47
Provides class member functions to access BlockCipher constants.
Definition: seckey.h:292
Crypto++ library namespace.
_
Definition: idea.h:15
Interface for retrieving values given their names.
Definition: cryptlib.h:261