struct SipHash(CROUNDS, DROUNDS)

Overview

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)

Defined in:

siphash.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.siphash(input : Bytes, output : Bytes, key : Key) #

[View source]
def self.siphash(input : Int | Float, key : Key) : UInt64 #

[View source]
def self.siphash(input : String, key : Key) : UInt64 #

[View source]
def self.siphash(input : Bytes, key : Key) : UInt64 #

[View source]

Instance Method Detail

def initialize #

[View source]