Crypto++ 8.2 Free C++ class library of cryptographic schemes

shacal2.h
Go to the documentation of this file.
1 // shacal.h - originally written and placed in the public domain by Wei Dai
2
3 /// \file shacal2.h
4 /// \brief Classes for the SHACAL-2 block cipher
5 /// \since Crypto++ 5.2, Intel SHA since Crypto++ 6.0
6
7 #ifndef CRYPTOPP_SHACAL2_H
8 #define CRYPTOPP_SHACAL2_H
9
10 #include "seckey.h"
11 #include "secblock.h"
12
13 NAMESPACE_BEGIN(CryptoPP)
14
15 /// \brief SHACAL2 block cipher information
16 struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64>
17 {
18 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SHACAL-2";}
19 };
20
21 /// \brief SHACAL2 block cipher
22 /// \since Crypto++ 5.2, Intel SHA since Crypto++ 6.0
23 /// \sa <a href="http://www.cryptopp.com/wiki/SHACAL-2">SHACAL-2</a>
24 class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation
25 {
26 /// \brief SHACAL2 block cipher transformation functions
27 /// \details Provides implementation common to encryption and decryption
28 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHACAL2_Info>
29 {
30 public:
31 std::string AlgorithmProvider() const;
32 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
33
34 protected:
35 FixedSizeAlignedSecBlock<word32, 64> m_key;
36
37 static const word32 K[64];
38 };
39
40 /// \brief SHACAL2 block cipher transformation functions
41 /// \details Encryption transformation
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
48 /// \brief SHACAL2 block cipher transformation functions
49 /// \details Decryption transformation
50 class CRYPTOPP_NO_VTABLE Dec : public Base
51 {
52 public:
53 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
54 };
55
56 public:
57 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
58 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
59 };
60
61 typedef SHACAL2::Encryption SHACAL2Encryption;
62 typedef SHACAL2::Decryption SHACAL2Decryption;
63
64 NAMESPACE_END
65
66 #endif
SHACAL2
SHACAL2 block cipher.
Definition: shacal2.h:24
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:398
BlockCipher
Interface for one direction (encryption or decryption) of a block cipher.
Definition: cryptlib.h:1278
secblock.h
Classes and functions for secure memory allocations.
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition: seckey.h:40
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherFinal< ENCRYPTION, Enc >
FixedSizeAlignedSecBlock< word32, 64 >
SHACAL2_Info
SHACAL2 block cipher information.
Definition: shacal2.h:16
VariableKeyLength
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:165
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:305
CryptoPP
Crypto++ library namespace.
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:321