struct

SipHash(CROUNDS, DROUNDS)

Inherits Struct / Value / Object

SipHash is a family of pseudorandom functions optimized for short inputs.

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 SipHash::Key
SecureRandom.random_bytes(key.to_slice)

hash = SipHash(2, 4).siphash("input data", key)

Constructors

Class methods

siphash(input : Bytes, output : Bytes, key : Key)
Source
siphash(input : Int | Float, key : Key) : UInt64
Source
siphash(input : String, key : Key) : UInt64
Source
siphash(input : Bytes, key : Key) : UInt64
Source

Instance methods

initialize
Source

Nested types