Crypto++  5.6.3
Free C++ class library of cryptographic schemes
shark.h
Go to the documentation of this file.
1 // shark.h - written and placed in the public domain by Wei Dai
2 
3 //! \file shark.h
4 //! \brief Classes for the SHARK block cipher
5 
6 #ifndef CRYPTOPP_SHARK_H
7 #define CRYPTOPP_SHARK_H
8 
9 #include "config.h"
10 #include "seckey.h"
11 #include "secblock.h"
12 
13 NAMESPACE_BEGIN(CryptoPP)
14 
15 //! _
16 struct SHARK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 16>, public VariableRounds<6, 2>
17 {
18  static const char *StaticAlgorithmName() {return "SHARK-E";}
19 };
20 
21 /// <a href="http://www.weidai.com/scan-mirror/cs.html#SHARK-E">SHARK-E</a>
23 {
24  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHARK_Info>
25  {
26  public:
27  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &param);
28 
29  protected:
30  unsigned int m_rounds;
31  SecBlock<word64> m_roundKeys;
32  };
33 
34  class CRYPTOPP_NO_VTABLE Enc : public Base
35  {
36  public:
37  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
38 
39  // used by Base to do key setup
40  void InitForKeySetup();
41 
42  private:
43  static const byte sbox[256];
44  static const word64 cbox[8][256];
45  };
46 
47  class CRYPTOPP_NO_VTABLE Dec : public Base
48  {
49  public:
50  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
51 
52  private:
53  static const byte sbox[256];
54  static const word64 cbox[8][256];
55  };
56 
57 public:
60 };
61 
64 
65 NAMESPACE_END
66 
67 #endif
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:385
SHARK-E
Definition: shark.h:22
Library configuration file.
Interface for one direction (encryption or decryption) of a block cipher.
Definition: cryptlib.h:1013
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.
_
Definition: shark.h:16
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:152
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