siphash
SipHash, a pseudorandom function optimized for short messages.
Summary
| Latest Version | 0.1.0 |
|---|---|
| License | GPLv3 |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-09-03 07:22 |
Tags
Authors
- Emery Hemingway
Installation
nimble install siphash
choosenim install siphash
git clone https://git.sr.ht/~ehmry/nim_siphash
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| siphash | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= | 0.19.0 | No |
Source
| Repository | https://git.sr.ht/~ehmry/nim_siphash |
|---|---|
| Homepage | https://git.sr.ht/~ehmry/nim_siphash |
| Documentation | View Documentation |
| Registry Source | nimble_official |
README
SipHash
SipHash is an add–rotate–xor (ARX) based family of pseudorandom functions. It may be used to implement hash tables with resistence to hash flooding.
See: https://en.wikipedia.org/wiki/SipHash
Usage
import hashes
proc hash(s: string): Hash =
var key: siphash.Key
# this is a keyed hash function, use a zero key
let b: array[8, byte] = sipHash(toOpenArrayByte(s, s.low, s.high), key)
# the hash fuction operates over byte arrays
result = cast[Hash](b)
# casting or converting is up to you