xrfang
xrfang

Reputation: 2280

go: how to convert string to hash.Hash64

I try to use https://pkg.go.dev/github.com/steakknife/bloomfilter but its Add() method requires a hash.Hash64, how can I convert a string (or []byte) to hash.Hash64?

Upvotes: 0

Views: 990

Answers (1)

John Nielsen
John Nielsen

Reputation: 194

A simple way is this:

myString := "hello world"
myHash := fnv.New64()
myHash.Write([]byte(myString))

Upvotes: 1

Related Questions