Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.DSI.Argon2

Argon2 per RFC 9106. Implements Argon2id (default), Argon2i and Argon2d.

  Argon2id uses Argon2i-style (password-independent, data-independent)
  reference-block addressing for the first half of the first pass over the
  memory, and Argon2d-style (data-dependent) addressing for the rest.

  Memory layout: m' = 4*p*floor(m/(4*p)) 1 KiB blocks, arranged as p lanes,
  each split into 4 vertical slices. The compression function G mixes two
  1 KiB blocks using the BLAKE2b round permutation (StreamSec.DSI.Blake2)
  applied first row-wise then column-wise over the 8x16 matrix of 64-bit
  words, with the final XOR-into-output (RFC 9106 section 3.4).

  Multi-lane (p>1) is supported and computed sequentially lane-by-lane within
  each slice (functionally identical to the parallel definition; no threads).

  The BLAKE2b core is constant-time (straight-line). The data-dependent
  addressing in the Argon2d/Argon2id passes is, by design of the algorithm,
  memory-access-pattern dependent on the password -- that is inherent to
  Argon2d and not a deviation.

Classes, interfaces and records

classeArgon2Error

inherits from Exception

(no public members)

interfaceiArgon2

inherits from iPBKDF

Argon2 as a framework KDF. Extends iPBKDF the same way iPBKDF extends iKDF: the RFC 9106 inputs that do not fit the DeriveKey(aPassword, aSalt, aIter, aDKLen) signature become properties. The inherited Iter property is the pass count t, so the inherited iPBKDF.DeriveKey overloads work unchanged with Parallelism/MemoryKiB/Secret/AssociatedData/Argon2Type taken from the properties.

function GetArgon2Type: tArgon2Type;
Getter for Argon2Type.
function GetAssociatedData: iSecretKey;
Getter for AssociatedData.
function GetMemoryKiB: Integer;
Getter for MemoryKiB.
function GetParallelism: Integer;
Getter for Parallelism.
function GetSecret: iSecretKey;
Getter for Secret.
procedure SetArgon2Type(const Value: tArgon2Type);
Setter for Argon2Type.
procedure SetAssociatedData(const Value: iSecretKey);
Setter for AssociatedData.
procedure SetMemoryKiB(const Value: Integer);
Setter for MemoryKiB.
procedure SetParallelism(const Value: Integer);
Setter for Parallelism.
procedure SetSecret(const Value: iSecretKey);
Setter for Secret.
function DeriveKey(const aPassword, aSalt, aSecret, aAD: tBytes; aParallelism, aMemoryKiB, aIterations, aTagLen: Integer; aType: tArgon2Type = a2dArgon2id): tBytes; overload;
Full RFC 9106 derivation with the same signature as the Argon2() routine; the derived tag is returned AND kept in the inherited iSecretKey.Key/KeyLen of the instance.
procedure DeriveKey(aPassword, aSalt, aSecret, aAD: iSecretKey; aParallelism, aMemoryKiB, aIterations, aTagLen: Integer; aType: tArgon2Type = a2dArgon2id); overload;
Same, with the key material passed as iSecretKey (aSecret/aAD may be nil); the derived tag is available via the inherited iSecretKey.Key / KeyLen afterwards.
property Argon2Type: tArgon2Type read GetArgon2Type write SetArgon2Type;
Argon2d / Argon2i / Argon2id (RFC 9106 recommends and defaults to Argon2id).
property AssociatedData: iSecretKey read GetAssociatedData write SetAssociatedData;
Optional associated data X (nil = none).
property MemoryKiB: Integer read GetMemoryKiB write SetMemoryKiB;
Memory cost m in KiB; must be >= 8*Parallelism. Default 65536 (64 MiB, the RFC 9106 sec.4 second recommended option).
property Parallelism: Integer read GetParallelism write SetParallelism;
Lane count p (1..2^24-1). Default 4 (RFC 9106 sec.4).
property Secret: iSecretKey read GetSecret write SetSecret;
Optional secret key / pepper K (nil = none).

classtArgon2

inherits from tPBKDF

implements iArgon2

constructor Create(aAlgorithm: ObjectIdentifier); procedure DeriveKey(aPassword, aSalt: iSecretKey; aIter, aDKLen: Integer); overload; override;
iPBKDF entry point: aIter is the Argon2 pass count t; the remaining inputs are taken from the properties.
function DeriveKey(const aPassword, aSalt, aSecret, aAD: tBytes; aParallelism, aMemoryKiB, aIterations, aTagLen: Integer; aType: tArgon2Type = a2dArgon2id): tBytes; overload; procedure DeriveKey(aPassword, aSalt, aSecret, aAD: iSecretKey; aParallelism, aMemoryKiB, aIterations, aTagLen: Integer; aType: tArgon2Type = a2dArgon2id); overload; property Argon2Type: tArgon2Type read GetArgon2Type write SetArgon2Type; property AssociatedData: iSecretKey read GetAssociatedData write SetAssociatedData; property MemoryKiB: Integer read GetMemoryKiB write SetMemoryKiB; property Parallelism: Integer read GetParallelism write SetParallelism; property Secret: iSecretKey read GetSecret write SetSecret;

Types (enumerations, sets, aliases)

enumtArgon2Type

  tArgon2Type = (a2dArgon2d, a2dArgon2i, a2dArgon2id);

Routines