8 #include <openssl/evp.h> 13 gsl::span<const uint8_t> data,
14 gsl::span<const uint8_t> salt,
16 size_t key_length)
const {
18 const auto *digest = EVP_sha512();
20 std::string pass(data.begin(), data.end());
22 int res = PKCS5_PBKDF2_HMAC(pass.data(),
42 return "failed to derive key";
44 return "unknown Pbkdf2ProviderError";
Class represents arbitrary (including empty) byte buffer.
OUTCOME_CPP_DEFINE_CATEGORY(kagome::crypto, Pbkdf2ProviderError, error)
outcome::result< common::Buffer > deriveKey(gsl::span< const uint8_t > data, gsl::span< const uint8_t > salt, size_t iterations, size_t key_length) const override
derives key from password and salt