Botan  2.11.0
Crypto and TLS for C++11
blowfish.h
Go to the documentation of this file.
1 /*
2 * Blowfish
3 * (C) 1999-2011 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_BLOWFISH_H_
9 #define BOTAN_BLOWFISH_H_
10 
11 #include <botan/block_cipher.h>
12 
13 namespace Botan {
14 
15 /**
16 * Blowfish
17 */
18 class BOTAN_PUBLIC_API(2,0) Blowfish final : public Block_Cipher_Fixed_Params<8, 1, 56>
19  {
20  public:
21  void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
22  void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
23 
24  /**
25  * Modified EKSBlowfish key schedule, used for bcrypt password hashing
26  */
27  void salted_set_key(const uint8_t key[], size_t key_length,
28  const uint8_t salt[], size_t salt_length,
29  const size_t workfactor, bool salt_first = false);
30 
31  BOTAN_DEPRECATED("Use Blowfish::salted_set_key taking salt length")
32  void eks_key_schedule(const uint8_t key[], size_t key_length,
33  const uint8_t salt[16], size_t workfactor)
34  {
35  salted_set_key(key, key_length, salt, 16, workfactor);
36  }
37 
38  void clear() override;
39  std::string name() const override { return "Blowfish"; }
40  BlockCipher* clone() const override { return new Blowfish; }
41  private:
42  void key_schedule(const uint8_t key[], size_t length) override;
43 
44  void key_expansion(const uint8_t key[],
45  size_t key_length,
46  const uint8_t salt[],
47  size_t salt_length);
48 
49  void generate_sbox(secure_vector<uint32_t>& box,
50  uint32_t& L, uint32_t& R,
51  const uint8_t salt[],
52  size_t salt_length,
53  size_t salt_off) const;
54 
55  secure_vector<uint32_t> m_S, m_P;
56  };
57 
58 }
59 
60 #endif
int(* final)(unsigned char *, CTX *)
void const uint8_t in[]
Definition: mgf1.h:26
char * name
Definition: ffi.h:330
const uint8_t uint8_t size_t blocks
Definition: ffi.h:691
class BOTAN_PUBLIC_API(2, 11) Argon2 final class BOTAN_PUBLIC_API(2, 11) Argon2_Family final void size_t const char size_t const uint8_t size_t const uint8_t key[]
Definition: argon2.h:87
Definition: alg_id.cpp:13
uint8_t out[]
Definition: pbkdf2.h:19
class BOTAN_PUBLIC_API(2, 0) AlgorithmIdentifier final bool BOTAN_PUBLIC_API(2, 0) operator
Name Constraints.
Definition: asn1_obj.h:66
class BOTAN_PUBLIC_API(2, 11) Argon2 final class BOTAN_PUBLIC_API(2, 11) Argon2_Family final void size_t const char size_t const uint8_t salt[]
Definition: argon2.h:87