Crypto++  5.6.3
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 The cipher's key, iv, block size and name information.
17 struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11>
18 {
19  static const char *StaticAlgorithmName() {return "3-Way";}
20 };
21 
22 // <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a>
23 
24 //! \class ThreeWay
25 //! \brief Provides 3-Way encryption and decryption
27 {
28  //! \class Base
29  //! \brief Class specific implementation and overrides used to operate the cipher.
30  //! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions
31  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<ThreeWay_Info>
32  {
33  public:
34  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
35 
36  protected:
37  unsigned int m_rounds;
39  };
40 
41  //! \class Enc
42  //! \brief Class specific methods used to operate the cipher in the forward direction.
43  //! \details Implementations and overrides in \p Enc apply to \p ENCRYPTION.
44  class CRYPTOPP_NO_VTABLE Enc : public Base
45  {
46  public:
47  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
48  };
49 
50  //! \class Dec
51  //! \brief Class specific methods used to operate the cipher in the reverse direction.
52  //! \details Implementations and overrides in \p Dec apply to \p DECRYPTION.
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:113
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:385
Library configuration file.
Classes and functions for secure memory allocations.
Inherited by block ciphers with fixed block size.
Definition: seckey.h:34
Inherited by ciphers with variable number of rounds.
Definition: seckey.h:60
Classes and functions for implementing secret key algorithms.
Provides 3-Way encryption and decryption.
Definition: 3way.h:26
The cipher&#39;s key, iv, block size and name information.
Definition: 3way.h:17
Provides class member functions to access BlockCipher constants.
Definition: seckey.h:292
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:261