Fabcoin Core  0.16.2
P2P Digital Currency
gost.h
Go to the documentation of this file.
1 // gost.h - written and placed in the public domain by Wei Dai
2 
5 
6 #ifndef CRYPTOPP_GOST_H
7 #define CRYPTOPP_GOST_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 
13 
14 struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
17 {
18  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "GOST";}
19 };
20 
24 class GOST : public GOST_Info, public BlockCipherDocumentation
25 {
28  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info>
29  {
30  public:
31  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
32 
33  protected:
34  static void PrecalculateSTable();
35 
36  static const byte sBox[8][16];
37  static volatile bool sTableCalculated;
38  static word32 sTable[4][256];
39 
41  };
42 
45  class CRYPTOPP_NO_VTABLE Enc : public Base
46  {
47  public:
48  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
49  };
50 
53  class CRYPTOPP_NO_VTABLE Dec : public Base
54  {
55  public:
56  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
57  };
58 
59 public:
62 };
63 
66 
68 
69 #endif
GOST block cipher encryption operation.
Definition: gost.h:45
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:127
BlockCipherFinal< ENCRYPTION, Enc > Encryption
Definition: gost.h:60
uint8_t byte
Definition: Common.h:57
#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
static volatile bool sTableCalculated
Definition: gost.h:37
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
GOST block cipher default operation.
Definition: gost.h:28
FixedSizeSecBlock< word32, 8 > m_key
Definition: gost.h:40
GOST::Encryption GOSTEncryption
Definition: gost.h:64
Classes and functions for secure memory allocations.
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Definition: gost.h:18
Classes and functions for implementing secret key algorithms.
GOST block cipher information.
Definition: gost.h:16
GOST block cipher.
Definition: gost.h:24
#define CRYPTOPP_NO_VTABLE
Definition: config.h:369
BlockCipherFinal< DECRYPTION, Dec > Decryption
Definition: gost.h:61
#define NAMESPACE_END
Definition: config.h:201
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:311
unsigned int word32
Definition: config.h:231
GOST block cipher decryption operation.
Definition: gost.h:53
GOST::Decryption GOSTDecryption
Definition: gost.h:65
Interface for retrieving values given their names.
Definition: cryptlib.h:279