Fabcoin Core  0.16.2
P2P Digital Currency
idea.h
Go to the documentation of this file.
1 // idea.h - written and placed in the public domain by Wei Dai
2 
5 
6 #ifndef CRYPTOPP_IDEA_H
7 #define CRYPTOPP_IDEA_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 
13 
14 struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8>
18 {
19  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "IDEA";}
20 };
21 
26 class IDEA : public IDEA_Info, public BlockCipherDocumentation
27 {
28 public: // made public for internal purposes
29 #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE
30  typedef word Word;
31 #else
32  typedef hword Word;
33 #endif
34 
35 private:
36  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<IDEA_Info>
37  {
38  public:
39  unsigned int OptimalDataAlignment() const {return 2;}
40  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
41 
42  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
43 
44  private:
45  void EnKey(const byte *);
46  void DeKey();
48 
49  #ifdef IDEA_LARGECACHE
50  static inline void LookupMUL(word &a, word b);
51  void LookupKeyLogs();
52  static void BuildLogTables();
53  static volatile bool tablesBuilt;
54  static word16 log[0x10000], antilog[0x10000];
55  #endif
56  };
57 
58 public:
61 };
62 
65 
67 
68 #endif
IDEA block cipher.
Definition: idea.h:26
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
Definition: idea.h:39
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:127
uint8_t byte
Definition: Common.h:57
word16 hword
Definition: config.h:307
#define CRYPTOPP_STATIC_CONSTEXPR
Definition: config.h:892
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:408
unsigned short word16
Definition: config.h:230
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
word Word
Definition: idea.h:30
FixedSizeSecBlock< Word, 6 *ROUNDS+4 > m_key
Definition: idea.h:47
Classes and functions for secure memory allocations.
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
#define a(i)
Classes and functions for implementing secret key algorithms.
Provides class member functions to key a block cipher.
Definition: seckey.h:324
BlockCipherFinal< ENCRYPTION, Base > Encryption
Definition: idea.h:59
BlockCipherFinal< DECRYPTION, Base > Decryption
Definition: idea.h:60
#define b(i, j)
Inherited by algorithms with fixed number of rounds.
Definition: seckey.h:53
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Definition: idea.h:19
#define CRYPTOPP_NO_VTABLE
Definition: config.h:369
IDEA::Encryption IDEAEncryption
Definition: idea.h:63
#define NAMESPACE_END
Definition: config.h:201
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:311
IDEA block cipher information.
Definition: idea.h:17
IDEA::Decryption IDEADecryption
Definition: idea.h:64
word32 word
Definition: config.h:308
Interface for retrieving values given their names.
Definition: cryptlib.h:279