list-version/util/hash.go

13 lines
183 B
Go
Raw Normal View History

2024-08-29 11:47:32 +08:00
package util
import (
"crypto/sha1"
"encoding/hex"
)
func ToHashHex(filePath string) string {
s1 := sha1.New()
buf := s1.Sum([]byte(filePath))
return hex.EncodeToString(buf)
}