FNVHash-Swift

master

A Swift implementation of the Fowler–Noll–Vo (FNV) hash function.
mauriciosantos/FNVHash-Swift

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

Description

  • Swift Tools
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 30 2026 22:00:33 GMT-0900 (Hawaii-Aleutian Daylight Time)