Botan 3.6.1
Crypto and TLS for C&
|
#include <pwdhash.h>
Public Member Functions | |
virtual std::unique_ptr< PasswordHash > | default_params () const =0 |
virtual std::unique_ptr< PasswordHash > | from_iterations (size_t iterations) const =0 |
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 > | 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 |
virtual | ~PasswordHashFamily ()=default |
Static Public Member Functions | |
static std::unique_ptr< PasswordHashFamily > | create (std::string_view algo_spec, std::string_view provider="") |
static std::unique_ptr< PasswordHashFamily > | create_or_throw (std::string_view algo_spec, std::string_view provider="") |
static std::vector< std::string > | providers (std::string_view algo_spec) |
|
virtualdefault |
|
static |
Create an instance based on a name If provider is empty then best available is chosen.
algo_spec | algorithm name |
provider | provider implementation to choose |
Definition at line 53 of file pwdhash.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), BOTAN_UNUSED, Botan::HashFunction::create(), and Botan::MessageAuthenticationCode::create().
Referenced by botan_pwdhash(), botan_pwdhash_timed(), and create_or_throw().
|
static |
Create an instance based on a name, or throw if the algo/provider combination cannot be found. If provider is empty then best available is chosen.
Definition at line 109 of file pwdhash.cpp.
References create().
Referenced by Botan::argon2_check_pwhash(), Botan::argon2_generate_pwhash(), Botan::CryptoBox::decrypt_bin(), and Botan::CryptoBox::encrypt().
|
pure virtual |
Return some default parameter set for this PBKDF that should be good enough for most users. The value returned may change over time as processing power and attacks improve.
Implemented in Botan::Argon2_Family, Botan::Bcrypt_PBKDF_Family, Botan::PBKDF2_Family, Botan::RFC4880_S2K_Family, and Botan::Scrypt_Family.
|
pure virtual |
Return a parameter chosen based on a rough approximation with the specified iteration count. The exact value this returns for a particular algorithm may change from over time. Think of it as an alternative to tune, where time is expressed in terms of PBKDF2 iterations rather than milliseconds.
Implemented in Botan::Argon2_Family, Botan::Bcrypt_PBKDF_Family, Botan::PBKDF2_Family, Botan::RFC4880_S2K_Family, and Botan::Scrypt_Family.
|
pure virtual |
Create a password hash using some scheme specific format. Parameters are as follows:
All unneeded parameters should be set to 0 or left blank.
Implemented in Botan::Argon2_Family, Botan::Bcrypt_PBKDF_Family, Botan::PBKDF2_Family, Botan::RFC4880_S2K_Family, and Botan::Scrypt_Family.
|
pure virtual |
Implemented in Botan::Argon2_Family, Botan::Bcrypt_PBKDF_Family, Botan::PBKDF2_Family, Botan::RFC4880_S2K_Family, and Botan::Scrypt_Family.
|
static |
Definition at line 117 of file pwdhash.cpp.
References Botan::probe_providers_of().
|
pure virtual |
Return a new parameter set tuned for this machine
Return a password hash instance tuned to run for approximately msec
milliseconds when producing an output of length output_length
. (Accuracy may vary, use the command line utility botan pbkdf_tune
to check.)
The parameters will be selected to use at most max_memory_usage_mb
megabytes of memory, or if left as zero any size is allowed.
This function works by runing a short tuning loop to estimate the performance of the algorithm, then scaling the parameters appropriately to hit the target size. The length of time the tuning loop runs can be controlled using the tuning_msec
parameter.
output_length | how long the output length will be |
msec | the desired execution time in milliseconds |
max_memory_usage_mb | some password hash functions can use a tunable amount of memory, in this case max_memory_usage limits the amount of RAM the returned parameters will require, in mebibytes (2**20 bytes). It may require some small amount above the request. Set to zero to place no limit at all. |
tuning_msec | how long to run the tuning loop |
Implemented in Botan::Argon2_Family, Botan::Bcrypt_PBKDF_Family, Botan::PBKDF2_Family, Botan::RFC4880_S2K_Family, and Botan::Scrypt_Family.