Crypto++ 8.9
Free C++ class library of cryptographic schemes
serpent.h
Go to the documentation of this file.
1// serpent.h - originally written and placed in the public domain by Wei Dai
2
3/// \file serpent.h
4/// \brief Classes for the Serpent block cipher
5/// \sa <a href="https://www.cl.cam.ac.uk/~rja14/serpent.html">A
6/// Candidate Block Cipher for the Advanced Encryption Standard</a>
7
8#ifndef CRYPTOPP_SERPENT_H
9#define CRYPTOPP_SERPENT_H
10
11#include "seckey.h"
12#include "secblock.h"
13
14NAMESPACE_BEGIN(CryptoPP)
15
16/// \brief Serpent block cipher information
17/// \since Crypto++ 3.1
18struct Serpent_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, public FixedRounds<32>
19{
20 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Serpent";}
21};
22
23/// \brief Serpent block cipher
24/// \sa <a href="http://www.cryptopp.com/wiki/Serpent">Serpent</a> on the
25/// Crypto++ wiki, <a href="https://www.cl.cam.ac.uk/~rja14/serpent.html">A
26/// Candidate Block Cipher for the Advanced Encryption Standard</a>
27/// \since Crypto++ 3.1
29{
30 /// \brief Serpen block cipher base implementation
31 /// \details Provides implementation common to encryption and decryption
32 /// \since Crypto++ 3.1
33 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Serpent_Info>
34 {
35 public:
36 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
37
38 protected:
40 };
41
42 /// \brief Serpent encryption transformation
43 /// \details Enc provides the encryption transformation.
44 /// All key sizes are supported.
45 /// \since Crypto++ 3.1
46 class CRYPTOPP_NO_VTABLE Enc : public Base
47 {
48 public:
49 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
50 };
51
52 /// \brief Serpent decryption transformation
53 /// \details Dec provides the decryption transformation.
54 /// All key sizes are supported.
55 /// \since Crypto++ 3.1
56 class CRYPTOPP_NO_VTABLE Dec : public Base
57 {
58 public:
59 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
60 };
61
62public:
65};
66
69
70NAMESPACE_END
71
72#endif // CRYPTOPP_SERPENT_H
Provides class member functions to key a block cipher.
Definition seckey.h:318
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 algorithms with fixed number of rounds.
Definition seckey.h:53
Fixed size stack-based SecBlock.
Definition secblock.h:1246
Interface for retrieving values given their names.
Definition cryptlib.h:327
Serpent block cipher.
Definition serpent.h:29
Inherited by keyed algorithms with variable key length.
Definition seckey.h:166
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
Serpent block cipher information.
Definition serpent.h:19