GSipHash

Package Version Hex Docs Package License Package Total Downloads Count Build Status Total Stars Count

Description

GSipHash is a small Gleam library that ports to Gleam the SipHash family of non-cryptographic hash functions, developed by Jean-Philippe Aumasson and Daniel J. Bernstein in 2012. The basic implementation follows an earlier one I wrote in C++ based on reading the original algorithm research paper and the C reference code, but prioritizing code clarity over constants and shortcuts. The test code is taken from the C reference test code.

Installation

gleam add gsiphash

Usage

import gsiphash

pub fn main()
{
    let assert Ok(0x3eb7d9b19dbec827) = gsiphash.siphash_2_4(from: <<"Hello world!":utf8>>, using: <<"8027f33015eaaba5":utf8>>)
    // The above function is an alias for calling the siphash function specifying 2 and 4 as the number of rounds C and D respectively.
    let assert Ok(0x3eb7d9b19dbec827) = gsiphash.siphash(<<"Hello world!":utf8>>, <<"8027f33015eaaba5":utf8>>, 2, 4)
}

License

GSipHash source code is avaliable under the MIT license.

Search Document