SipHash

The class provides functionality to initialize the internal state of the SipHash hash function and generate a hash for byte arrays.

class SipHash (
ubyte NUMBER_OF_COMPRESS_ROUNDS = 2
ubyte NUMBER_OF_FINALIZATION_ROUNDS = 4
) {}

Constructors

this
this()

Default constructor. Initializes the internal state of the function with a random 128-bit key (split into two 64-bit parts).

this
this(ulong key0, ulong key1)

Basic constructor. Initializes the internal state with a 128-bit key, split into two 64-bit parts - the low-order and high-order parts of the key.

this
this(ubyte[] key)

Basic constructor. Initializes the internal state with a 128-bit key. If key length less than 16 bytes (i.e 128 bit), the key will padded with padding method 2.

Members

Functions

append
void append(ubyte[] buffer)

Append bytes to internal hash-function state.

finalize
ulong finalize()

Perform finalization of hash-function and returns hash.

Parameters

NUMBER_OF_COMPRESS_ROUNDS

Number of compression rounds (default: 2).

NUMBER_OF_FINALIZATION_ROUNDS

Number of finalization rounds (default: 4).

Meta