mirror of
https://github.com/taigrr/colorhash.git
synced 2026-04-02 03:08:48 -07:00
use fnv instead of md5
This commit is contained in:
3
hash.go
3
hash.go
@@ -3,6 +3,7 @@ package go_colorhash
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/binary"
|
||||
"hash/fnv"
|
||||
"io"
|
||||
)
|
||||
|
||||
@@ -10,7 +11,7 @@ const MaxUint = ^uint(0)
|
||||
const MaxInt = int(MaxUint >> 1)
|
||||
|
||||
func HashString(s string) int {
|
||||
h := md5.New()
|
||||
h := fnv.New64()
|
||||
io.WriteString(h, s)
|
||||
hashb := h.Sum(nil)
|
||||
hashb = hashb[len(hashb)-8:]
|
||||
|
||||
Reference in New Issue
Block a user