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:
parent
629bafaa7f
commit
ce7e87f290
1 changed files with 2 additions and 2 deletions
|
@ -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]))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue