mirror of
https://github.com/taigrr/colorhash.git
synced 2026-04-01 18:58:45 -07:00
Cleanup and committal of ansi table
This commit is contained in:
12
hash.go
12
hash.go
@@ -1,14 +1,15 @@
|
||||
package go_colorhash
|
||||
package colorhash
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/binary"
|
||||
"hash/fnv"
|
||||
"io"
|
||||
)
|
||||
|
||||
const MaxUint = ^uint(0)
|
||||
const MaxInt = int(MaxUint >> 1)
|
||||
const (
|
||||
MaxUint = ^uint(0)
|
||||
MaxInt = int(MaxUint >> 1)
|
||||
)
|
||||
|
||||
func HashString(s string) int {
|
||||
h := fnv.New64()
|
||||
@@ -22,8 +23,9 @@ func HashString(s string) int {
|
||||
}
|
||||
return sint
|
||||
}
|
||||
|
||||
func HashBytes(r io.Reader) int {
|
||||
h := md5.New()
|
||||
h := fnv.New64()
|
||||
io.Copy(h, r)
|
||||
hashb := h.Sum(nil)
|
||||
hashb = hashb[len(hashb)-8:]
|
||||
|
||||
Reference in New Issue
Block a user