RFC 7914 "The scrypt Password-Based Key Derivation Function".
scrypt(P, S, N, r, p, dkLen) is the sequential-memory-hard PBKDF built from:
- PBKDF2-HMAC-SHA256 (RFC 8018) for the outer/inner key stretch,
- the Salsa20/8 core (RFC 7914 sec.3),
- scryptBlockMix (sec.4) and the memory-hard scryptROMix (sec.5).
The PBKDF2 steps use the library's generic RFC 8018 implementation
(stPkcs5.tPBKDF2_HMAC with SHA-256); PBKDF2_HMAC_SHA256 below is a thin
wrapper over it, kept exported for API compatibility. Self-test: TestSCrypt
(the RFC 7914 sec.12 vectors, up to N=16384; the 1 GiB N=1048576 vector is
omitted). The PBES2 wiring in the PKCS#8 / PKCS#12 layers calls SCrypt()
directly with the scrypt-params N/r/p.
iSCrypt / tSCrypt integrate scrypt into the stKDF class hierarchy (iPBKDF /
tPBKDF): the inherited Iter property doubles as N (CostParameter delegates to
it), BlockSize (r) and Parallelization (p) are additional properties, and the
full six-parameter derivation is available as DeriveKey overloads mirroring
the SCrypt() routine.inherits from Exception
(no public members)
inherits from iPBKDF
scrypt as a framework KDF. Extends iPBKDF the same way iPBKDF extends iKDF: the parameters that do not fit the DeriveKey(aPassword, aSalt, aIter, aDKLen) signature become properties. The inherited Iter property carries the scrypt cost parameter N (CostParameter below is a delegate for it), so the inherited iPBKDF.DeriveKey overloads work unchanged with aIter = N and r/p taken from the properties.
function GetBlockSize: Integer;
function GetCostParameter: Integer;
function GetParallelization: Integer;
procedure SetBlockSize(const Value: Integer);
procedure SetCostParameter(const Value: Integer);
procedure SetParallelization(const Value: Integer);
function DeriveKey(const aPassword, aSalt: tBytes; aN, aR, aP, aDKLen: Integer): tBytes; overload;
procedure DeriveKey(aPassword, aSalt: iSecretKey; aN, aR, aP, aDKLen: Integer); overload;
property BlockSize: Integer read GetBlockSize write SetBlockSize;
property CostParameter: Integer read GetCostParameter write SetCostParameter;
property Parallelization: Integer read GetParallelization write SetParallelization;
inherits from tPBKDF
implements iSCrypt
constructor Create(aAlgorithm: ObjectIdentifier);
procedure DeriveKey(aPassword, aSalt: iSecretKey; aIter, aDKLen: Integer); overload; override;
function DeriveKey(const aPassword, aSalt: tBytes; aN, aR, aP, aDKLen: Integer): tBytes; overload;
procedure DeriveKey(aPassword, aSalt: iSecretKey; aN, aR, aP, aDKLen: Integer); overload;
property BlockSize: Integer read GetBlockSize write SetBlockSize;
property CostParameter: Integer read GetCostParameter write SetCostParameter;
property Parallelization: Integer read GetParallelization write SetParallelization;