Crypto++  5.6.5
Free C++ class library of cryptographic schemes
3way.h
Go to the documentation of this file.
1 // 3way.h - written and placed in the public domain by Wei Dai
2 
3 //! \file 3way.h
4 //! \brief Classes for the 3-Way block cipher
5 
6 #ifndef CRYPTOPP_THREEWAY_H
7 #define CRYPTOPP_THREEWAY_H
8 
9 #include "config.h"
10 #include "seckey.h"
11 #include "secblock.h"
12 
13 NAMESPACE_BEGIN(CryptoPP)
14 
15 //! \class ThreeWay_Info
16 //! \brief ThreeWay block cipher information
17 struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11>
18 {
19  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "3-Way";}
20 };
21 
22 //! \class ThreeWay
23 //! \brief ThreeWay block cipher
24 //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a>
26 {
27  //! \class Base
28  //! \brief Class specific implementation and overrides used to operate the cipher.
29  //! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions
30  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<ThreeWay_Info>
31  {
32  public:
33  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
34 
35  protected:
36  unsigned int m_rounds;
38  };
39 
40  //! \class Enc
41  //! \brief Class specific methods used to operate the cipher in the forward direction.
42  //! \details Implementations and overrides in \p Enc apply to \p ENCRYPTION.
43  class CRYPTOPP_NO_VTABLE Enc : public Base
44  {
45  public:
46  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
47  };
48 
49  //! \class Dec
50  //! \brief Class specific methods used to operate the cipher in the reverse direction.
51  //! \details Implementations and overrides in \p Dec apply to \p DECRYPTION.
52  class CRYPTOPP_NO_VTABLE Dec : public Base
53  {
54  public:
55  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
56  };
57 
58 public:
61 };
62 
65 
66 NAMESPACE_END
67 
68 #endif
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:127
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:408
Library configuration file.
Classes and functions for secure memory allocations.
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
Inherited by algorithms with variable number of rounds.
Definition: seckey.h:66
Classes and functions for implementing secret key algorithms.
ThreeWay block cipher.
Definition: 3way.h:25
ThreeWay block cipher information.
Definition: 3way.h:17
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:311
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:279