Crypto++  5.6.5
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 
12 NAMESPACE_BEGIN(CryptoPP)
13 
14 /// \brief Blowfish block cipher information
15 struct 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 
44 public:
47 };
48 
51 
52 NAMESPACE_END
53 
54 #endif
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...
Definition: seckey.h:419
Blowfish block cipher.
Definition: blowfish.h:24
Classes and functions for secure memory allocations.
Inherited by algorithms with fixed block size.
Definition: seckey.h:39
Classes and functions for implementing secret key algorithms.
Provides class member functions to key a block cipher.
Definition: seckey.h:338
Blowfish block cipher information.
Definition: blowfish.h:15
Inherited by algorithms with fixed number of rounds.
Definition: seckey.h:74
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:187
static const int ROUNDS
The number of rounds for the algorithm provided as a constant.
Definition: seckey.h:78
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