10#define BOTAN_PBKDF2_H_
13#include <botan/pbkdf.h>
14#include <botan/pwdhash.h>
22size_t pbkdf2(MessageAuthenticationCode& prf,
25 std::string_view passphrase,
29 std::chrono::milliseconds msec);
35void pbkdf2(MessageAuthenticationCode& prf,
52 size_t iterations()
const override {
return m_iterations; }
54 std::string to_string()
const override;
56 void derive_key(uint8_t out[],
61 size_t salt_len)
const override;
64 std::unique_ptr<MessageAuthenticationCode> m_prf;
73 PBKDF2_Family(std::unique_ptr<MessageAuthenticationCode> prf) : m_prf(std::move(prf)) {}
75 std::string
name()
const override;
77 std::unique_ptr<PasswordHash>
tune(
size_t output_len,
78 std::chrono::milliseconds msec,
80 std::chrono::milliseconds tune_msec)
const override;
89 std::unique_ptr<PasswordHash>
from_iterations(
size_t iter)
const override;
91 std::unique_ptr<PasswordHash>
from_params(
size_t iter,
size_t,
size_t)
const override;
94 std::unique_ptr<MessageAuthenticationCode> m_prf;
102 std::string
name()
const override;
104 std::unique_ptr<PBKDF> new_object()
const override;
106 size_t pbkdf(uint8_t output_buf[],
108 std::string_view passphrase,
109 const uint8_t salt[],
112 std::chrono::milliseconds msec)
const override;
129 std::unique_ptr<MessageAuthenticationCode> m_mac;
PBKDF2_Family(std::unique_ptr< MessageAuthenticationCode > prf)
PBKDF2(const MessageAuthenticationCode &prf, size_t iter)
virtual std::string name() const =0
virtual std::unique_ptr< PasswordHash > from_iterations(size_t iterations) const =0
virtual std::unique_ptr< PasswordHash > default_params() const =0
virtual std::unique_ptr< PasswordHash > from_params(size_t i1, size_t i2=0, size_t i3=0) const =0
virtual std::unique_ptr< PasswordHash > tune(size_t output_length, std::chrono::milliseconds msec, size_t max_memory_usage_mb=0, std::chrono::milliseconds tuning_msec=std::chrono::milliseconds(10)) const =0
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
#define BOTAN_DEPRECATED(msg)
size_t pbkdf2(MessageAuthenticationCode &prf, uint8_t out[], size_t out_len, std::string_view password, const uint8_t salt[], size_t salt_len, size_t iterations, std::chrono::milliseconds msec)