Leosac  0.8.0
Open Source Access Control
Scrypt Class Reference

#include <Scrypt.hpp>

+ Collaboration diagram for Scrypt:

Static Public Member Functions

static ScryptResult Hash (const std::vector< uint8_t > &in, const std::vector< uint8_t > &salt, const ScryptParam &param=default_)
 Wrapper around low-level hash function. More...
 
static ScryptResult Hash (const std::vector< uint8_t > &in, const ScryptParam &param=default_)
 Scrypt hash the in byte vector. More...
 
static bool Verify (const std::vector< uint8_t > &in, const ScryptResult &expected)
 Verify that the input in, when hashed, correspond to the expected ScryptResult. More...
 

Static Private Attributes

static ScryptParam default_ = {.N = 16384, .r = 8, .p = 1, .len = 64}
 

Detailed Description

Definition at line 132 of file Scrypt.hpp.

Member Function Documentation

◆ Hash() [1/2]

ScryptResult Scrypt::Hash ( const std::vector< uint8_t > &  in,
const ScryptParam param = default_ 
)
static

Scrypt hash the in byte vector.

A random salt is generated.

Parameters
in
param
Returns
A ScryptResult object providing all information about the hash.

Definition at line 44 of file Scrypt.cpp.

◆ Hash() [2/2]

ScryptResult Scrypt::Hash ( const std::vector< uint8_t > &  in,
const std::vector< uint8_t > &  salt,
const ScryptParam param = default_ 
)
static

Wrapper around low-level hash function.

Parameters
invector to hash
saltSalt to use when hashing.
hashlenthe length of the output hash
Returns
Binary hash

Definition at line 25 of file Scrypt.cpp.

◆ Verify()

bool Scrypt::Verify ( const std::vector< uint8_t > &  in,
const ScryptResult expected 
)
static

Verify that the input in, when hashed, correspond to the expected ScryptResult.

Parameters
in
o
Returns
Wether or not the hash match.

Definition at line 49 of file Scrypt.cpp.

Member Data Documentation

◆ default_

ScryptParam Scrypt::default_ = {.N = 16384, .r = 8, .p = 1, .len = 64}
staticprivate

Definition at line 169 of file Scrypt.hpp.


The documentation for this class was generated from the following files: