# GSipHash
[](https://hex.pm/packages/gsiphash)
[](https://hexdocs.pm/gsiphash/)
[](https://hex.pm/packages/gsiphash)
[](https://hex.pm/packages/gsiphash)
[](https://hex.pm/packages/gsiphash)
[](https://hex.pm/packages/gsiphash)
## 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](https://www.aumasson.jp/siphash/siphash.pdf) and the [C reference code](https://github.com/veorq/SipHash), but prioritizing code clarity over constants and shortcuts. The test code is taken from the [C reference test code](https://github.com/veorq/SipHash/blob/master/test.c).
## Installation
```sh
gleam add gsiphash
```
## Usage
```gleam
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](/LICENSE).