Botan 3.0.0-alpha0
Crypto and TLS for C&
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
13namespace Botan {
14
15/**
16* Blowfish
17*/
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 void clear() override;
32 std::string name() const override { return "Blowfish"; }
33 std::unique_ptr<BlockCipher> new_object() const override { return std::make_unique<Blowfish>(); }
34 private:
35 void key_schedule(const uint8_t key[], size_t length) override;
36
37 void key_expansion(const uint8_t key[],
38 size_t key_length,
39 const uint8_t salt[],
40 size_t salt_length);
41
42 void generate_sbox(secure_vector<uint32_t>& box,
43 uint32_t& L, uint32_t& R,
44 const uint8_t salt[],
45 size_t salt_length,
46 size_t salt_off) const;
47
49 };
50
51}
52
53#endif
std::unique_ptr< BlockCipher > new_object() const override
Definition: blowfish.h:33
std::string name() const override
Definition: blowfish.h:32
int(* final)(unsigned char *, CTX *)
#define BOTAN_TEST_API
Definition: compiler.h:51
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65