Crypto++  5.6.5
Free C++ class library of cryptographic schemes
shark.h
Go to the documentation of this file.
1 // shark.h - originally 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 /// \brief SHARK block cipher information
16 struct SHARK_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<6, 2>
17 {
18  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SHARK-E";}
19 };
20 
21 /// \brief SHARK block cipher
22 /// <a href="http://www.cryptopp.com/wiki/SHARK-E">SHARK-E</a>
24 {
25  /// \brief SHARK block cipher default operation
26  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHARK_Info>
27  {
28  public:
29  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &param);
30 
31  protected:
32  unsigned int m_rounds;
33  SecBlock<word64> m_roundKeys;
34  };
35 
36  /// \brief SHARK block cipher encryption operation
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  // used by Base to do key setup
43  void InitForKeySetup();
44 
45  private:
46  static const byte sbox[256];
47  static const word64 cbox[8][256];
48  };
49 
50  /// \brief SHARK block cipher decryption operation
51  class CRYPTOPP_NO_VTABLE Dec : public Base
52  {
53  public:
54  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
55 
56  private:
57  static const byte sbox[256];
58  static const word64 cbox[8][256];
59  };
60 
61 public:
64 };
65 
68 
69 NAMESPACE_END
70 
71 #endif
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:146
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:419
SHARK block cipher SHARK-E
Definition: shark.h:23
Library configuration file.
Interface for one direction (encryption or decryption) of a block cipher.
Definition: cryptlib.h:1228
Classes and functions for secure memory allocations.
Inherited by algorithms with fixed block size.
Definition: seckey.h:39
Inherited by algorithms with variable number of rounds.
Definition: seckey.h:86
Classes and functions for implementing secret key algorithms.
SHARK block cipher information.
Definition: shark.h:16
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:326
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:291