Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

stSHA3

.$DEFINE PUREPASCAL

Classes, interfaces and records

recordtState

procedure Theta; procedure Rho; procedure Pi; procedure Chi; procedure Iota(aRound: Integer); procedure Perm; inline; function PermTo: tA; inline;

classtBaseSHA3

inherits from tHash

class function Rate: Integer; override; procedure HashData(const aData; aCount: Int64); override; procedure HashBits(const aData; aBitOffset, aBitCount: Int64); override; procedure HashBits(const aData; aBitCount: Int64); override; procedure GetContext(Context: Pointer); override; procedure SetUpContext(Context: Pointer); override; class procedure SelfTest; virtual;

classtSHA3_224

inherits from tBaseSHA3

class function DERPrefix: Pointer; override;
Returns a pointer to DERPrefixSHA3_224.
class function DERPrefixLen: Integer; override;
Delegates to SizeOf, forwarding DERPrefixSHA3_224, and returns its result.
class function DigestSize: Integer; override;
Always returns 28.
class function Algorithm: tHashAlgorithm; override;
Returns haSHA3_224, see tHashAlgorithm.
class procedure SelfTest; override;

classtSHA3_256

inherits from tBaseSHA3

class function DERPrefix: Pointer; override;
Returns a pointer to DERPrefixSHA3_256.
class function DERPrefixLen: Integer; override;
Delegates to SizeOf, forwarding DERPrefixSHA3_256, and returns its result.
class function DigestSize: Integer; override;
Always returns 32.
class function Algorithm: tHashAlgorithm; override;
Returns haSHA3_256, see tHashAlgorithm.
class procedure SelfTest; override;

classtSHA3_384

inherits from tBaseSHA3

class function DERPrefix: Pointer; override;
Returns a pointer to DERPrefixSHA3_384.
class function DERPrefixLen: Integer; override;
Delegates to SizeOf, forwarding DERPrefixSHA3_384, and returns its result.
class function DigestSize: Integer; override;
Always returns 48.
class function Algorithm: tHashAlgorithm; override;
Returns haSHA3_384, see tHashAlgorithm.
class procedure SelfTest; override;

classtSHA3_512

inherits from tBaseSHA3

class function DERPrefix: Pointer; override;
Returns a pointer to DERPrefixSHA3_512.
class function DERPrefixLen: Integer; override;
Delegates to SizeOf, forwarding DERPrefixSHA3_512, and returns its result.
class function DigestSize: Integer; override;
Always returns 64.
class function Algorithm: tHashAlgorithm; override;
Returns haSHA3_512, see tHashAlgorithm.
class procedure SelfTest; override;

classtBaseShake

inherits from tOptionallyRefCountedObject

implements iRawRandom, iRawRandomEx

class function SecurityStrength: Cardinal; virtual;
Always returns 0.
class function Rate: Integer; class procedure SelfTest; virtual; procedure SetUp; procedure Done; procedure HashData(const aData; aCount: Int64); procedure HashBits(const aData; aBitCount: Int64); procedure RawRandom(var X; MaxBitSize: Cardinal); overload; procedure RawRandom(var X: tBytes); overload; procedure RawRandom(var X: tBytes; ByteOffset, MaxBitSize: Cardinal); overload; function GetSecurityStrength: Cardinal; virtual;
Returns the value of SecurityStrength.

classtShake128

inherits from tBaseShake

class function SecurityStrength: Cardinal; override;
Always returns 128.
class procedure SelfTest; override;

classtShake256

inherits from tBaseShake

class function SecurityStrength: Cardinal; override;
Always returns 256.
class procedure SelfTest; override;

classtBaseSHAKEHash

inherits from tHash

SHAKE as a fixed-output tHash (so it can be used as a tHashAlgorithm, e.g. the RFC 8419 Ed448 messageDigest = SHAKE256 with 64-byte output). This is a self-contained Keccak sponge (parallel to tBaseSHA3) that differs only in the fixed rate (per security strength, independent of the output length) and the SHAKE domain suffix (1111 -> $1F byte-aligned, vs SHA3's 01 -> $06).

class function Capacity: Integer; virtual; abstract;
capacity in bytes (32 for SHAKE128 = 256-bit, 64 for SHAKE256 = 512-bit); the sponge rate is 200 - capacity.
class function Rate: Integer; override; procedure HashData(const aData; aCount: Int64); override; procedure HashBits(const aData; aBitCount: Int64); overload; override; procedure HashBits(const aData; aBitOffset, aBitCount: Int64); overload; override; procedure GetContext(Context: Pointer); override; procedure SetUpContext(Context: Pointer); override; class procedure SelfTest; virtual;

classtSHAKE128Hash

inherits from tBaseSHAKEHash

class function Capacity: Integer; override;
Always returns 32.
class function DigestSize: Integer; override;
Always returns 32.
class function Algorithm: tHashAlgorithm; override;
Returns haSHAKE128, see tHashAlgorithm.
class procedure SelfTest; override;

classtSHAKE256Hash

inherits from tBaseSHAKEHash

class function Capacity: Integer; override;
Always returns 64.
class function DigestSize: Integer; override;
Always returns 64.
class function Algorithm: tHashAlgorithm; override;
Returns haSHAKE256, see tHashAlgorithm.
class procedure SelfTest; override;

Types (enumerations, sets, aliases)

arraytPos

  tPos = array [0..1] of Integer;

arraytPerm

  tPerm = array [0..24] of tPos;

arraytA

  tA = array [0..24] of UInt64;

typepState

  pState = ^tState;

Routines