Standard library / hash/maphash

hash/maphash.Hash.Write()

Add bytes to the running hash. Returns the full byte count and nil error. This is not a cryptographic authentication primitive. Expected stdout: '2 <nil> true\n'.

Formal Syntax & Structure

go syntaxgo
func (h *Hash) Write(b []byte) (int, error)

Parameters & Attributes

NameTypeDescription
b[]byteInput bytes to hash.

Return Value

(int, error)

Full input byte count and nil error.

Working Example

Example Snippetgo
package main
import (  "fmt"  "hash/maphash")
func main() {  var h maphash.Hash  n, e := h.Write([]byte("Go"))  fmt.Println(n, e, h.Sum64() == maphash.String(h.Seed(), "Go"))}
Go Reference