ingress-nginx-helm/pkg/file/file.go
Manuel de Brito Fontes d6d374b28d Update dependencies
2017-10-06 19:40:31 -03:00

19 lines
297 B
Go

package file
import (
"crypto/sha1"
"encoding/hex"
"io/ioutil"
)
// SHA1 returns the SHA1 of a file.
func SHA1(filename string) string {
hasher := sha1.New()
s, err := ioutil.ReadFile(filename)
if err != nil {
return ""
}
hasher.Write(s)
return hex.EncodeToString(hasher.Sum(nil))
}