Crypto++  5.6.4
Free C++ class library of cryptographic schemes
gost.h
Go to the documentation of this file.
1 // gost.h - written and placed in the public domain by Wei Dai
2 
3 //! \file gost.h
4 //! \brief Classes for the GIST block cipher
5 
6 #ifndef CRYPTOPP_GOST_H
7 #define CRYPTOPP_GOST_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 
12 NAMESPACE_BEGIN(CryptoPP)
13 
14 //! \class GOST_Info
15 //! \brief GOST block cipher information
16 struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
17 {
18  CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "GOST";}
19 };
20 
21 //! \class GOST
22 //! \brief GOST block cipher
23 //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#GOST">GOST</a>
24 class GOST : public GOST_Info, public BlockCipherDocumentation
25 {
26  //! \class Base
27  //! \brief GOST block cipher default operation
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 
43  //! \class Enc
44  //! \brief GOST block cipher encryption operation
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 
51  //! \class Dec
52  //! \brief GOST block cipher decryption operation
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 
67 NAMESPACE_END
68 
69 #endif
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:128
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:423
Classes and functions for secure memory allocations.
Inherited by algorithms with fixed block size.
Definition: seckey.h:34
Classes and functions for implementing secret key algorithms.
GOST block cipher information.
Definition: gost.h:16
GOST block cipher.
Definition: gost.h:24
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:326
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:282