SipHash

SipHash object implements std.digest like API for supporting streaming update.

Constructors

this
this(ubyte[16] key)

Constructs SipHash with 16 byte key.

this
this(ulong key0, ulong key1)

Constructs SipHash with two 8 byte key numbers.

Members

Functions

finish
ubyte[8] finish()

Returns the finished SipHash hash as ubyte[8], not ulong. This also calls start to reset the internal state.

put
void put(const(ubyte)[] data)

Use this to feed the digest with data. Also implements the std.range.OutputRange interface for ubyte and const(ubyte)[].

start
void start()

Used to initialize the SipHash.

Examples

ubyte[16] key = cast(ubyte[])"To be|not to be!";
auto sh = SipHash!(2, 4)(key);

sh.start();
foreach (chunk; chunks(cast(ubyte[])"that is the question.", 2))
    sh.put(chunk);
auto hashed = sh.finish();

Meta