Botan 2.19.3
Crypto and TLS for C&
pbkdf1.h
Go to the documentation of this file.
1/*
2* PBKDF1
3* (C) 1999-2007 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_PBKDF1_H_
9#define BOTAN_PBKDF1_H_
10
11#include <botan/pbkdf.h>
12#include <botan/hash.h>
13
15
16namespace Botan {
17
18/**
19* PKCS #5 v1 PBKDF, aka PBKDF1
20* Can only generate a key up to the size of the hash output.
21* Unless needed for backwards compatibility, use PKCS5_PBKDF2
22*/
24 {
25 public:
26 /**
27 * Create a PKCS #5 instance using the specified hash function.
28 * @param hash pointer to a hash function object to use
29 */
30 explicit PKCS5_PBKDF1(HashFunction* hash) : m_hash(hash) {}
31
32 std::string name() const override
33 {
34 return "PBKDF1(" + m_hash->name() + ")";
35 }
36
37 PBKDF* clone() const override
38 {
39 return new PKCS5_PBKDF1(m_hash->clone());
40 }
41
42 size_t pbkdf(uint8_t output_buf[], size_t output_len,
43 const std::string& passphrase,
44 const uint8_t salt[], size_t salt_len,
45 size_t iterations,
46 std::chrono::milliseconds msec) const override;
47 private:
48 std::unique_ptr<HashFunction> m_hash;
49 };
50
51}
52
53#endif
virtual size_t pbkdf(uint8_t out[], size_t out_len, const std::string &passphrase, const uint8_t salt[], size_t salt_len, size_t iterations, std::chrono::milliseconds msec) const =0
PKCS5_PBKDF1(HashFunction *hash)
Definition pbkdf1.h:30
PBKDF * clone() const override
Definition pbkdf1.h:37
std::string name() const override
Definition pbkdf1.h:32
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition compiler.h:136
MechanismType hash
size_t salt_len
Definition x509_obj.cpp:25