Skip to content

Instantly share code, notes, and snippets.

Created Mar 1, 2021
What would you like to do?
FNV Hash - Go
package main
import "fmt"
func fnvHash32(key string) uint32 {
hash := uint32(2156825496)
const prime32 = uint32(16777619)
for i := 0; i < len(key); i++ {
hash *= prime32
hash ^= uint32(key[i])
return hash
func main() {
fmt.Println(fnvHash32("Hello World!"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment