7#ifndef BOTAN_PWDHASH_H_
8#define BOTAN_PWDHASH_H_
10#include <botan/types.h>
84 void hash(std::span<uint8_t> out, std::string_view password, std::span<const uint8_t> salt)
const {
85 this->derive_key(out.data(), out.size(), password.data(), password.size(), salt.data(), salt.size());
105 void hash(std::span<uint8_t> out,
106 std::string_view password,
107 std::span<const uint8_t> salt,
108 std::span<const uint8_t> associated_data,
109 std::span<const uint8_t> key)
const {
110 this->derive_key(out.data(),
116 associated_data.data(),
117 associated_data.size(),
137 const char* password,
139 const uint8_t salt[],
140 size_t salt_len)
const = 0;
162 virtual void derive_key(uint8_t out[],
164 const char* password,
166 const uint8_t salt[],
171 size_t key_len)
const;
183 static std::unique_ptr<PasswordHashFamily> create(std::string_view algo_spec, std::string_view provider =
"");
190 static std::unique_ptr<PasswordHashFamily> create_or_throw(std::string_view algo_spec,
191 std::string_view provider =
"");
196 static std::vector<std::string> providers(std::string_view algo_spec);
203 virtual std::string
name()
const = 0;
231 virtual std::unique_ptr<PasswordHash>
tune(
232 size_t output_length,
233 std::chrono::milliseconds msec,
234 size_t max_memory_usage_mb = 0,
235 std::chrono::milliseconds tuning_msec = std::chrono::milliseconds(10))
const = 0;
261 virtual std::unique_ptr<PasswordHash>
from_params(
size_t i1,
size_t i2 = 0,
size_t i3 = 0)
const = 0;
virtual std::string name() const =0
virtual std::unique_ptr< PasswordHash > from_iterations(size_t iterations) const =0
virtual ~PasswordHashFamily()=default
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
void hash(std::span< uint8_t > out, std::string_view password, std::span< const uint8_t > salt, std::span< const uint8_t > associated_data, std::span< const uint8_t > key) const
virtual bool supports_keyed_operation() const
void hash(std::span< uint8_t > out, std::string_view password, std::span< const uint8_t > salt) const
virtual size_t total_memory_usage() const
virtual size_t parallelism() const
virtual size_t iterations() const =0
virtual ~PasswordHash()=default
virtual void derive_key(uint8_t out[], size_t out_len, const char *password, size_t password_len, const uint8_t salt[], size_t salt_len) const =0
virtual bool supports_associated_data() const
virtual size_t memory_param() const
virtual std::string to_string() const =0
#define BOTAN_PUBLIC_API(maj, min)