Crypto++ 8.7
Free C++ class library of cryptographic schemes
blowfish.h
Go to the documentation of this file.
1// blowfish.h - originally written and placed in the public domain by Wei Dai
2
3/// \file blowfish.h
4/// \brief Classes for the Blowfish block cipher
5
6#ifndef CRYPTOPP_BLOWFISH_H
7#define CRYPTOPP_BLOWFISH_H
8
9#include "seckey.h"
10#include "secblock.h"
11
12NAMESPACE_BEGIN(CryptoPP)
13
14/// \brief Blowfish block cipher information
15struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4, 56>, public FixedRounds<16>
16{
17 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Blowfish";}
18};
19
20// <a href="http://www.cryptopp.com/wiki/Blowfish">Blowfish</a>
21
22/// \brief Blowfish block cipher
23/// \since Crypto++ 1.0
25{
26 /// \brief Class specific implementation and overrides used to operate the cipher.
27 /// \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions
28 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Blowfish_Info>
29 {
30 public:
31 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
32 void UncheckedSetKey(const byte *key_string, unsigned int keylength, const NameValuePairs &params);
33
34 private:
35 void crypt_block(const word32 in[2], word32 out[2]) const;
36
37 static const word32 p_init[ROUNDS+2];
38 static const word32 s_init[4*256];
39
42 };
43
44public:
47};
48
51
52NAMESPACE_END
53
54#endif
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
Blowfish block cipher.
Definition: blowfish.h:25
Inherited by algorithms with fixed block size.
Definition: seckey.h:41
Inherited by algorithms with fixed number of rounds.
Definition: seckey.h:53
static const int ROUNDS
The number of rounds for the algorithm provided as a constant.
Definition: seckey.h:56
Interface for retrieving values given their names.
Definition: cryptlib.h:322
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:166
unsigned int word32
32-bit unsigned datatype
Definition: config_int.h:62
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
Blowfish block cipher information.
Definition: blowfish.h:16