GenerateArgon2Hash()

Returns hash of input using Argon2.

Introduced: 5.3.8.18

Requires Extension: Argon2 Extension

GenerateArgon2Hash( input=string, variant=string, parallelismFactor=number, memoryCost=number, iterations=number );

Returns: String

Argument Description Default
input
string, required

Input string.

variant
string, optional

Either Argon2i, Argon2d or Argon2id

Introduced: 5.3.8.43

argon2i

parallelismFactor
number, optional

Degrees of parallelism, a number between 1 and 10.

1

memoryCost
number, optional

A number between 8 and 100000.

8

iterations
number, optional

A number between 1 and 20.

1

Examples

secret = createUUID();
    dump(var=secret, label="input string");
<span class="nv">hashed</span> <span class="o">=</span> <span class="nf">generateArgon2Hash</span><span class="p">(</span><span class="nv">secret</span><span class="p">);</span>
<span class="nf">dump</span><span class="p">(</span><span class="k">var</span><span class="o">=</span><span class="nv">hashed</span><span class="p">,</span> <span class="nv">label</span><span class="o">=</span><span class="s2">&quot;generateArgon2Hash&quot;</span><span class="p">);</span>
<span class="nv">decoded</span><span class="o">=</span> <span class="nf">argon2checkhash</span><span class="p">(</span><span class="nv">secret</span><span class="p">,</span> <span class="nv">hashed</span><span class="p">);</span>
<span class="nf">dump</span><span class="p">(</span><span class="k">var</span><span class="o">=</span><span class="nv">decoded</span><span class="p">,</span> <span class="nv">label</span><span class="o">=</span><span class="s2">&quot;argon2checkhash matches&quot;</span><span class="p">);</span>

See also