Botan 1.10.17

pbkdf.h
Go to the documentation of this file.
1 /*
2 * PBKDF
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_PBKDF_H__
9 #define BOTAN_PBKDF_H__
10
11 #include <botan/algo_base.h>
12 #include <botan/symkey.h>
13
14 namespace Botan {
15
16 /**
17 * Base class for PBKDF (password based key derivation function)
18 * implementations. Converts a password into a key using a salt
19 * and iterated hashing to make brute force attacks harder.
20 */
21 class BOTAN_DLL PBKDF : public Algorithm
22 {
23 public:
24
25 /**
26 * @return new instance of this same algorithm
27 */
28 virtual PBKDF* clone() const = 0;
29
30 void clear() {}
31
32 /**
33 * Derive a key from a passphrase
34 * @param output_len the desired length of the key to produce
35 * @param passphrase the password to derive the key from
36 * @param salt a randomly chosen salt
37 * @param salt_len length of salt in bytes
38 * @param iterations the number of iterations to use (use 10K or more)
39 */
40 virtual OctetString derive_key(size_t output_len,
41 const std::string& passphrase,
42 const byte salt[], size_t salt_len,
43 size_t iterations) const = 0;
44 };
45
46 /**
47 * For compatability with 1.8
48 */
49 typedef PBKDF S2K;
50
51 }
52
53 #endif
Botan::PBKDF::clear
void clear()
Definition: pbkdf.h:30
Botan::OctetString
Definition: symkey.h:19
Botan::S2K
PBKDF S2K
Definition: pbkdf.h:49
Botan::byte
unsigned char byte
Definition: types.h:22
Botan
Definition: algo_base.h:14
Botan::Algorithm
Definition: algo_base.h:19
Botan::PBKDF
Definition: pbkdf.h:21