26 const std::vector<uint8_t> &salt,
const ScryptParam ¶m)
32 std::vector<uint8_t> out;
33 out.resize(param.
len);
35 int ret = libscrypt_scrypt(in.data(), in.size(), salt.data(), salt.size(),
36 param.
N, param.
r, param.
p, out.data(), out.size());
38 throw std::runtime_error(
"FAILED TO SCRYPT");
51 auto out =
Hash(in, expected.
salt, expected.
p);
52 return out.hash == expected.
hash;
57 return N == o.
N && p == o.
p && r == o.
r && len == o.
len;
62 return p == o.
p && salt == o.
salt && hash == o.
hash;
std::vector< uint8_t > salt
Salt used for generation.
static ScryptResult Hash(const std::vector< uint8_t > &in, const std::vector< uint8_t > &salt, const ScryptParam ¶m=default_)
Wrapper around low-level hash function.
bool operator==(const ScryptResult &o) const
static ByteVector GetBytes(size_t n)
Generate n random bytes.
static ScryptParam default_
bool operator!=(const ScryptResult &o) const
ScryptParam p
Parameters used to generated the hash.
static bool Verify(const std::vector< uint8_t > &in, const ScryptResult &expected)
Verify that the input in, when hashed, correspond to the expected ScryptResult.
bool operator==(const ScryptParam &o) const
std::vector< uint8_t > hash
The hash.