struct SipHash64(CROUNDS, DROUNDS)

Overview

A streaming version of SipHash with a fixed UInt64 output.

You may choose how many compression-rounds and finalization-rounds to execute. For example SipHash(2, 4) has been verified to be cryptographically secure, whereas SipHash(1, 3) is faster but not verified, and should only be used when the result is never disclosed (e.g. for table hashing).

See https://131002.net/siphash/ for more information.

Example:

key = uninitialized SipHash64::Key
SecureRandom.random_bytes(key.to_slice)

hasher = SipHash64(2, 4).new(key)
hasher.update("some ")
hasher.update("input data")
hash = hasher.final

Defined in:

siphash64.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(key : Key) #

[View source]

Instance Method Detail

def final(output : Bytes) : Nil #

[View source]
def final #

[View source]
def update(data : String) : Nil #

[View source]
def update(data : Bytes) : Nil #

[View source]