wallet/src/secrets.h
2022-06-30 16:55:37 +10:00

15 lines
758 B
C++

#pragma once
//Derive a Short text Secret from a 256 bit random value and a sixty four bit integer
std::array<char, 0x1b> DeriveTextSecret(const ristretto255::scalar& blob, uint_fast64_t i);
//Derive a strong scalar secret from a string with password strengthening.
//Net effect is convert one scalar into another by a process that is lengthy and costly.
ristretto255::scalar DeriveStrongSecret(const char* const passwd);
//Derive scalar secret from another quickly.
ristretto255::scalar DeriveSecret(const ristretto255::scalar &sc, uint_fast64_t i);
template <class T, std::enable_if_t<std::_Is_standard_unsigned_integer<T>, int> = 0>
constexpr int rounded_log2(const T val) noexcept {
return std::numeric_limits<T>::digits - std::countl_zero(val);
}