Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.DSI.Blake2

BLAKE2b per RFC 7693.

  Provides:
    - tBlake2b: an incremental, optionally keyed BLAKE2b state with arbitrary
      digest length 1..64 bytes.
    - tBlake2b512Hash: BLAKE2b-512 as a framework tHash (registered under
      haBlake2b512 / id_blake2b512), so BLAKE2b can be selected wherever a
      tHashClass / tHashAlgorithm is expected. The tHash wrapper is the plain
      unkeyed 64-byte-digest hash; RFC 7693 native keyed (MAC) mode remains
      available through tBlake2b / Blake2b() below.
    - Blake2b(): one-shot convenience function (unkeyed or keyed).
    - Blake2bLong(): the Argon2 "H'" variable-length hash construction
      (RFC 9106 section 3.2, the H' function used to expand block output).

  The core compression function F is shared by Argon2's G permutation, but
  Argon2 implements its own block mixing (see StreamSec.DSI.Argon2); the
  Blake2bRound primitive is exported here so Argon2 can reuse the same
  round permutation over its 1 KiB blocks.

  No secret-dependent branching: the round function and compression are
  straight-line. The one-shot/keyed paths copy and wipe the key block.

Classes, interfaces and records

classeBlake2Error

inherits from Exception

(no public members)

recordtBlake2b

procedure Init(aOutLen: Integer; const aKey: tBytes);
aOutLen 1..64; aKey may be empty (unkeyed) or 1..64 bytes (keyed/MAC).
procedure Update(const aData; aLen: Integer); overload; procedure Update(const aData: tBytes); overload; function Final: tBytes;

classtBlake2b512Hash

inherits from tHash

BLAKE2b-512 as a tHash, parallel to the SHAKE fixed-output classes in stSHA3. Wraps the tBlake2b record in unkeyed sequential mode with the full 64-byte digest. The generic keyed-hash machinery of tHash (Key/KeyedHashMethod) and the HMAC routines in stSecUtils pad to BLAKE2b's 128-byte block (tHash.Rate), which is HMAC over BLAKE2b as RFC 2104 defines it. That is not RFC 7693's own keyed BLAKE2b: for that MAC use tBlake2b.Init/Blake2b() with a key.

class function Algorithm: tHashAlgorithm; override;
Returns haBlake2b512, see tHashAlgorithm.
class function DigestSize: Integer; override;
Returns the value of cBlake2bOutBytesMax.
procedure HashData(const aData; aCount: Int64); override; procedure GetContext(Context: Pointer); override; procedure SetUpContext(Context: Pointer); override; class procedure SelfTest;

Types (enumerations, sets, aliases)

arraytBlake2bBlock

  tBlake2bBlock = array [0..15] of UInt64; // 16 x 64-bit words = 128 bytes

typepBlake2b

  pBlake2b = ^tBlake2b;

Routines