list-version/util/hash.go

14 lines
179 B
Go
Raw Normal View History

2024-08-29 11:47:32 +08:00
package util
import (
2024-08-30 09:15:24 +08:00
"crypto/md5"
"fmt"
"io"
2024-08-29 11:47:32 +08:00
)
func ToHashHex(filePath string) string {
2024-08-30 09:15:24 +08:00
h := md5.New()
io.WriteString(h, filePath)
return fmt.Sprintf("%x", h.Sum(nil))
2024-08-29 11:47:32 +08:00
}