Crypto++
cast.h
Go to the documentation of this file.
1 #ifndef CRYPTOPP_CAST_H
2 #define CRYPTOPP_CAST_H
3 
4 /** \file
5 */
6 
7 #include "seckey.h"
8 #include "secblock.h"
9 
10 NAMESPACE_BEGIN(CryptoPP)
11 
12 class CAST
13 {
14 protected:
15  static const word32 S[8][256];
16 };
17 
18 //! algorithm info
19 struct CAST128_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 5, 16>
20 {
21  static const char *StaticAlgorithmName() {return "CAST-128";}
22 };
23 
24 /// <a href="http://www.weidai.com/scan-mirror/cs.html#CAST-128">CAST-128</a>
26 {
27  class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl<CAST128_Info>
28  {
29  public:
30  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
31 
32  protected:
33  bool reduced;
35  };
36 
37  class CRYPTOPP_NO_VTABLE Enc : public Base
38  {
39  public:
40  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
41  };
42 
43  class CRYPTOPP_NO_VTABLE Dec : public Base
44  {
45  public:
46  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
47  };
48 
49 public:
52 };
53 
54 //! algorithm info
55 struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32>
56 {
57  static const char *StaticAlgorithmName() {return "CAST-256";}
58 };
59 
60 //! <a href="http://www.weidai.com/scan-mirror/cs.html#CAST-256">CAST-256</a>
62 {
63  class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl<CAST256_Info>
64  {
65  public:
66  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
67  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
68 
69  protected:
70  static const word32 t_m[8][24];
71  static const unsigned int t_r[8][24];
72 
73  static void Omega(int i, word32 kappa[8]);
74 
76  };
77 
78 public:
81 };
82 
85 
88 
89 NAMESPACE_END
90 
91 #endif
These objects usually should not be used directly. See CipherModeDocumentation instead.
Definition: seckey.h:188
CAST-128
Definition: cast.h:25
to be inherited by block ciphers with fixed block size
Definition: seckey.h:21
CAST-256
Definition: cast.h:61
Definition: cast.h:12
support query of variable key length, template parameters are default, min, max, multiple (default mu...
Definition: seckey.h:80
algorithm info
Definition: cast.h:55
algorithm info
Definition: cast.h:19
interface for retrieving values given their names
Definition: cryptlib.h:224