[#wallet-CCrypter-SetKeyFromPassphrase]
= xref:wallet.adoc[wallet]::xref:wallet/CCrypter.adoc[CCrypter]::SetKeyFromPassphrase
:relfileprefix: ../../
:mrdocs:

Derives the encryption key and IV from a passphrase and salt&period;

== Synopsis

Declared in `&lt;wallet&sol;crypter&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
bool
SetKeyFromPassphrase(
    xref:SecureString.adoc[SecureString] const& key&lowbar;data,
    std::span&lt;unsigned char const&gt; salt,
    unsigned int rounds,
    unsigned int derivation&lowbar;method);
----

== Return Value

true if the key was derived and set successfully&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *key&lowbar;data*
| The passphrase to derive the key from&period;
| *salt*
| The salt to mix into the derivation&period;
| *rounds*
| The number of derivation rounds to perform&period;
| *derivation&lowbar;method*
| The derivation method to use (0 &equals; SHA&hyphen;512)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
