Fabcoin Core  0.16.2
P2P Digital Currency
cast.h
Go to the documentation of this file.
1 // cast.h - written and placed in the public domain by Wei Dai
2 
5 
6 #ifndef CRYPTOPP_CAST_H
7 #define CRYPTOPP_CAST_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 
13 
14 class CAST
17 {
18 protected:
19  static const word32 S[8][256];
20 };
21 
24 struct CAST128_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 5, 16>
25 {
26  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CAST-128";}
27 };
28 
33 {
36  class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl<CAST128_Info>
37  {
38  public:
39  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
40 
41  protected:
42  bool reduced;
44  };
45 
48  class CRYPTOPP_NO_VTABLE Enc : public Base
49  {
50  public:
51  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
52  };
53 
56  class CRYPTOPP_NO_VTABLE Dec : public Base
57  {
58  public:
59  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
60  };
61 
62 public:
65 };
66 
69 struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 4>
70 {
71  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "CAST-256";}
72 };
73 
78 {
81  class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl<CAST256_Info>
82  {
83  public:
84  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
85  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
86 
87  protected:
88  static const word32 t_m[8][24];
89  static const unsigned int t_r[8][24];
90 
91  static void Omega(int i, word32 kappa[8]);
92 
94  };
95 
96 public:
99 };
100 
103 
106 
108 
109 #endif
BlockCipherFinal< DECRYPTION, Base > Decryption
Definition: cast.h:98
CAST128 block cipher default operation.
Definition: cast.h:36
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
FixedSizeSecBlock< word32, 32 > K
Definition: cast.h:43
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
CAST256::Encryption CAST256Encryption
Definition: cast.h:104
bool reduced
Definition: cast.h:42
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Definition: cast.h:71
Classes and functions for secure memory allocations.
CAST128 block cipher.
Definition: cast.h:32
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
CAST128::Decryption CAST128Decryption
Definition: cast.h:102
BlockCipherFinal< ENCRYPTION, Enc > Encryption
Definition: cast.h:63
CAST256 block cipher.
Definition: cast.h:77
Classes and functions for implementing secret key algorithms.
BlockCipherFinal< ENCRYPTION, Base > Encryption
Definition: cast.h:97
CAST128::Encryption CAST128Encryption
Definition: cast.h:101
CAST block cipher base.
Definition: cast.h:16
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:169
BlockCipherFinal< DECRYPTION, Dec > Decryption
Definition: cast.h:64
#define CRYPTOPP_NO_VTABLE
Definition: config.h:369
CAST256 block cipher information.
Definition: cast.h:69
CAST256::Decryption CAST256Decryption
Definition: cast.h:105
CAST128 block cipher decryption operation.
Definition: cast.h:56
#define NAMESPACE_END
Definition: config.h:201
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Definition: cast.h:26
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:311
#define S(a)
Definition: mars.cpp:50
unsigned int word32
Definition: config.h:231
CAST128 block cipher information.
Definition: cast.h:24
CAST128 block cipher encryption operation.
Definition: cast.h:48
CAST256 block cipher default operation.
Definition: cast.h:81
Interface for retrieving values given their names.
Definition: cryptlib.h:279
FixedSizeSecBlock< word32, 8 *12 > K
Definition: cast.h:93