← All compilation units

Flyology.Postgres.SCRAM_Core

Description

Constant-shape cryptographic primitives used by SCRAM-SHA-256.

Byte_Array

subtype Byte_Array is HMAC_SHA256.Byte_Array;

Byte sequence accepted by the HMAC-SHA-256 implementation.

Digest

subtype Digest is HMAC_SHA256.HMAC_Digest;

Fixed-size SHA-256 digest.

Exclusive_Or

procedure Exclusive_Or
  (Left, Right : Digest; Result : out Digest)

Compute the bytewise exclusive-or of two digests.

Parameters
Left

First digest operand.

Right

Second digest operand.

Result

Left xor Right.

Hash

procedure Hash (Data : Byte_Array; Result : out Digest)

Compute SHA-256 over Data.

Parameters
Data

Exact byte sequence to hash.

Result

Resulting 32-byte digest.

PBKDF2_HMAC_SHA256

procedure PBKDF2_HMAC_SHA256
  (Password   : Byte_Array;
   Salt       : Byte_Array;
   Iterations : Positive;
   Result     : out Digest)

Derive one SHA-256 block using PBKDF2-HMAC-SHA-256.

Parameters
Password

Exact password octets; no text normalization occurs.

Salt

Salt octets mixed into every derivation round.

Iterations

Positive PBKDF2 iteration count.

Result

Derived 32-byte key.

Wipe

procedure Wipe (Value : out Digest)

Overwrite a digest with zeros before it leaves sensitive scope.

Parameters
Value

Digest storage to clear.