Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 863 Bytes

README.md

File metadata and controls

37 lines (24 loc) · 863 Bytes

A Swift implementation of the Fowler–Noll–Vo (FNV) hash function

This code provides implementations of the FNV-1 and FNV-1a hash functions in pure Swift. Computes 64-bit hashes on 64-bit devices and 32-bit hashes on 32-bit devices.

Usage

// Strings

let fnv1Hash = fnv1("test")
let fnv1aHash = fnv1a("test")

// Integers, Floats, Doubles

let fnv1Hash = fnv1(5)
let fnv1aHash = fnv1a(5.5)

// Raw bytes

let bytes: [UInt8] = [10, 20, 30]

let fnv1Hash = fnv1(bytes)
let fnv1aHash = fnv1a(bytes)

Additional information

Fowler–Noll–Vo hash function

Contact

Mauricio Santos, mauriciosantoss@gmail.com