Standard library / hash/maphash

hash/maphash.Bytes()

Hash a byte slice directly under an initialized seed. Equivalent to a fresh Hash with the same seed and bytes. This is not a cryptographic authentication primitive. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func Bytes(seed Seed, b []byte) uint64

Parameters & Attributes

NameTypeDescription
seedSeedInitialized process-local seed from MakeSeed or Hash.Seed.
b[]byteInput bytes to hash.

Return Value

uint64

64-bit unsigned result.

Working Example

Example Snippetgo
package main
import (  "fmt"  "hash/maphash")
func main() {  s := maphash.MakeSeed()  fmt.Println(maphash.Bytes(s, []byte("hello")) == maphash.String(s, "hello"))}
Go Reference