Ejemplo n.º 1
0
static inline token hash(token const& pw, token const& salt)
{
	token result;
	if(::libscrypt_scrypt(
		pw.data(), pw.size(),
		salt.data(), salt.size(),
		SCRYPT_N, SCRYPT_r, SCRYPT_p,
		result.data(), result.size()
	) == -1)
		throw std::runtime_error("Incapable of hashing token");

	return result;
}
Ejemplo n.º 2
0
static inline token hash(const std::string &pw, token const& salt)
{
	token result;
	if(::libscrypt_scrypt(
		(const uint8_t*)pw.data(), pw.size(),
		salt.data(), salt.size(),
		SCRYPT_N, SCRYPT_r, SCRYPT_p,
		result.data(), result.size()
	) == -1)
		throw std::runtime_error("Incapable of hashing plaintext");

	return result;
}
Ejemplo n.º 3
0
	/*
	 * Returns the number of children tokens at current token
	 */
	unsigned int get_size(void) { return cur->size(); }