9 #ifndef CPPSECURITY_PASSWORD_HASHING_BCRYPT_H
10 #define CPPSECURITY_PASSWORD_HASHING_BCRYPT_H
47 size_t workfactor() const noexcept {
return _workfactor; }
50 const std::string&
name()
const override {
return _name; }
52 std::string
GenerateHash(std::string_view password, std::string_view salt)
const override;
53 std::string
GenerateDigest(std::string_view password)
const override;
54 bool Validate(std::string_view password, std::string_view hash, std::string_view salt)
const override;
55 bool ValidateDigest(std::string_view password, std::string_view digest)
const override;
58 static std::string _name;
'bcrypt' password hashing algorithm
BcryptPasswordHashing & operator=(const BcryptPasswordHashing &)=default
BcryptPasswordHashing(BcryptPasswordHashing &&)=default
bool ValidateDigest(std::string_view password, std::string_view digest) const override
Validate the user password over the given secure digest string.
std::string GenerateDigest(std::string_view password) const override
Generate the secure digest string for the given user password.
std::string GenerateHash(std::string_view password, std::string_view salt) const override
Generate the strong password hash for the given user password and unique salt.
const std::string & name() const override
Get the password hashing algorithm name.
std::string GenerateSalt() const override
Generate the unique password salt.
bool Validate(std::string_view password, std::string_view hash, std::string_view salt) const override
Validate the user password over the given strong password hash and unique salt.
size_t workfactor() const noexcept
Get the work factor.
~BcryptPasswordHashing()=default
BcryptPasswordHashing(const BcryptPasswordHashing &)=default
BcryptPasswordHashing(size_t workfactor=4)
Initialize 'bcrypt' password hashing with required parameters.
BcryptPasswordHashing & operator=(BcryptPasswordHashing &&)=default
Password hashing interface.
Password hashing interface definition.