1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2025-02-03 00:53:32 +00:00

shorten the hash

This commit is contained in:
Vincent Batts 2013-11-07 10:01:36 -05:00
parent 629bafaa7f
commit ce7e87f290

View file

@ -37,6 +37,6 @@ func GetMd5FromBytes(blob []byte) (sum []byte) {
/* get a small, decently unique hash */ /* get a small, decently unique hash */
func GetSmallHash() (small_hash string) { func GetSmallHash() (small_hash string) {
h := sha256.New() h := sha256.New()
io.WriteString(h, fmt.Sprintf("%d%d", time.Now().UnixNano(), Rand64())) io.WriteString(h, fmt.Sprintf("%d%d", Rand64()))
return strings.ToLower(fmt.Sprintf("%X", h.Sum(nil)[0:9])) return strings.ToLower(fmt.Sprintf("%X", h.Sum(nil)[0:4]))
} }