Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com> Co-authored-by: xgopilot <noreply@goplus.org>
24 lines
343 B
Go
24 lines
343 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"hash/maphash"
|
|
)
|
|
|
|
func main() {
|
|
var h maphash.Hash
|
|
h.WriteString("hello")
|
|
hash1 := h.Sum64()
|
|
fmt.Printf("0x%x\n", hash1)
|
|
|
|
h.Reset()
|
|
h.WriteString("world")
|
|
hash2 := h.Sum64()
|
|
fmt.Printf("0x%x\n", hash2)
|
|
|
|
h.Reset()
|
|
h.WriteString("hello")
|
|
hash3 := h.Sum64()
|
|
fmt.Printf("0x%x == 0x%x\n", hash1, hash3)
|
|
}
|