Crypto++
twofish.h
Go to the documentation of this file.
1 #ifndef CRYPTOPP_TWOFISH_H
2 #define CRYPTOPP_TWOFISH_H
3 
4 /** \file
5 */
6 
7 #include "seckey.h"
8 #include "secblock.h"
9 
10 NAMESPACE_BEGIN(CryptoPP)
11 
12 //! _
13 struct Twofish_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>, FixedRounds<16>
14 {
15  static const char *StaticAlgorithmName() {return "Twofish";}
16 };
17 
18 /// <a href="http://www.weidai.com/scan-mirror/cs.html#Twofish">Twofish</a>
20 {
21  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Twofish_Info>
22  {
23  public:
24  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
25 
26  protected:
27  static word32 h0(word32 x, const word32 *key, unsigned int kLen);
28  static word32 h(word32 x, const word32 *key, unsigned int kLen);
29 
30  static const byte q[2][256];
31  static const word32 mds[4][256];
32 
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 
56 
57 NAMESPACE_END
58 
59 #endif