CppSecurity 1.1.2.0
C++ Security Library
Loading...
Searching...
No Matches
password_hashing_bcrypt.h
Go to the documentation of this file.
1
9#ifndef CPPSECURITY_PASSWORD_HASHING_BCRYPT_H
10#define CPPSECURITY_PASSWORD_HASHING_BCRYPT_H
11
12#include "password_hashing.h"
13
14namespace CppSecurity {
15
17
32{
33public:
35
42
45
47 size_t workfactor() const noexcept { return _workfactor; }
48
49 // Implementation of PasswordHashing
50 const std::string& name() const override { return _name; }
51 std::string GenerateSalt() const override;
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;
56
57private:
58 static std::string _name;
59 size_t _workfactor;
60};
61
64} // namespace CppSecurity
65
66#endif // CPPSECURITY_PASSWORD_HASHING_BCRYPT_H
'bcrypt' password hashing algorithm
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.
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.
BcryptPasswordHashing & operator=(BcryptPasswordHashing &&)=default
size_t workfactor() const noexcept
Get the work factor.
BcryptPasswordHashing(const BcryptPasswordHashing &)=default
const std::string & name() const override
Get the password hashing algorithm name.
BcryptPasswordHashing & operator=(const BcryptPasswordHashing &)=default
Password hashing interface.
Password hashing interface definition.