9 #ifndef CPPSECURITY_PASSWORD_HASHING_SCRYPT_H
10 #define CPPSECURITY_PASSWORD_HASHING_SCRYPT_H
46 uint64_t
n() const noexcept {
return _n; }
48 uint32_t
r() const noexcept {
return _r; }
50 uint32_t
p() const noexcept {
return _p; }
53 const std::string&
name()
const override {
return _name; }
54 std::string
GenerateHash(std::string_view password, std::string_view salt)
const override;
55 bool Validate(std::string_view password, std::string_view hash, std::string_view salt)
const override;
58 static std::string _name;
Password hashing interface.
size_t salt_length() const noexcept
Get the unique password salt length.
size_t hash_length() const noexcept
Get the strong password hash length.
'scrypt' password hashing algorithm
const std::string & name() const override
Get the password hashing algorithm name.
uint32_t r() const noexcept
Get the RAM Cost.
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.
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.
~ScryptPasswordHashing()=default
ScryptPasswordHashing(const ScryptPasswordHashing &)=default
ScryptPasswordHashing(size_t hash_length=32, size_t salt_length=32, uint64_t n=512, uint32_t r=8, uint32_t p=1)
Initialize 'scrypt' password hashing with required parameters.
ScryptPasswordHashing(ScryptPasswordHashing &&)=default
ScryptPasswordHashing & operator=(const ScryptPasswordHashing &)=default
uint32_t p() const noexcept
Get the degree of parallelism.
ScryptPasswordHashing & operator=(ScryptPasswordHashing &&)=default
uint64_t n() const noexcept
Get the CPU AND RAM cost.
Password hashing interface definition.