struct HalfSipHash(CROUNDS, DROUNDS)

Overview

An alternative SipHash pseudorandom function that uses a 64-bit key and generates 32-bit or 64-bit hashes, meant for 32-bit platforms. On 64-bit platform we advise to use SipHash instead.

While SipHash(2, 4) has been analyzed and verified to be cryptographically secure, HalfSipHash has not, and isn't expected to be. Results from the hasher should never be disclosed (e.g. use for table hashing on 32-bit).

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

Example:

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

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

Defined in:

halfsiphash.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) : UInt32 #

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

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

[View source]

Instance Method Detail

def initialize #

[View source]