Derives the encryption key and IV from a passphrase and salt.

Synopsis

Declared in <wallet/crypter.h>

[[nodiscard]]
bool
SetKeyFromPassphrase(
    SecureString const& key_data,
    std::span<unsigned char const> salt,
    unsigned int rounds,
    unsigned int derivation_method);

Return Value

true if the key was derived and set successfully.

Note

The return value should not be discarded.

Parameters

Name

Description

key_data

The passphrase to derive the key from.

salt

The salt to mix into the derivation.

rounds

The number of derivation rounds to perform.

derivation_method

The derivation method to use (0 = SHA‐512).

Created with MrDocs