Standard library / hash/maphash
hash/maphash.Hash.SetSeed()
Replace the seed and discard all previously accumulated input. The supplied seed must be initialized. This is not a cryptographic authentication primitive. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (h *Hash) SetSeed(seed Seed)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| seed | Seed | Initialized process-local seed from MakeSeed or Hash.Seed. |
Working Example
Example Snippetgo
package main
import ( "fmt" "hash/maphash")
func main() { var h maphash.Hash h.WriteString("old") s := maphash.MakeSeed() h.SetSeed(s) h.WriteString("new") fmt.Println(h.Sum64() == maphash.String(s, "new"))}