Crypto++ 8.7
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/// \since Crypto++ 2.1
6
7#ifndef CRYPTOPP_SHARK_H
8#define CRYPTOPP_SHARK_H
9
10#include "config.h"
11#include "seckey.h"
12#include "secblock.h"
13
14NAMESPACE_BEGIN(CryptoPP)
15
16/// \brief SHARK block cipher information
17/// \since Crypto++ 2.1
18struct SHARK_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<6, 2>
19{
20 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SHARK-E";}
21};
22
23/// \brief SHARK block cipher
24/// <a href="http://www.cryptopp.com/wiki/SHARK-E">SHARK-E</a>
25/// \since Crypto++ 2.1
27{
28 /// \brief SHARK block cipher default operation
29 /// \since Crypto++ 2.1
30 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHARK_Info>
31 {
32 public:
33 void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &param);
34
35 protected:
36 unsigned int m_rounds;
37 SecBlock<word64> m_roundKeys;
38 };
39
40 /// \brief SHARK block cipher encryption operation
41 /// \since Crypto++ 2.1
42 class CRYPTOPP_NO_VTABLE Enc : public Base
43 {
44 public:
45 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
46
47 // used by Base to do key setup
48 void InitForKeySetup();
49
50 private:
51 static const byte sbox[256];
52 static const word64 cbox[8][256];
53 };
54
55 /// \brief SHARK block cipher decryption operation
56 /// \since Crypto++ 2.1
57 class CRYPTOPP_NO_VTABLE Dec : public Base
58 {
59 public:
60 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
61
62 private:
63 static const byte sbox[256];
64 static const word64 cbox[8][256];
65 };
66
67public:
70};
71
74
75NAMESPACE_END
76
77#endif
Interface for one direction (encryption or decryption) of a block cipher.
Definition: cryptlib.h:1283
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:306
Inherited by algorithms with fixed block size.
Definition: seckey.h:41
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:125
Interface for retrieving values given their names.
Definition: cryptlib.h:322
SHARK block cipher SHARK-E
Definition: shark.h:27
Inherited by algorithms with variable number of rounds.
Definition: seckey.h:65
Library configuration file.
unsigned long long word64
64-bit unsigned datatype
Definition: config_int.h:91
Crypto++ library namespace.
Classes and functions for secure memory allocations.
Classes and functions for implementing secret key algorithms.
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition: seckey.h:399
SHARK block cipher information.
Definition: shark.h:19