func GetFileMD5(pathName string) (string) {
f, err := os.Open(pathName)
if err != nil {
fmt.Println("Open", err)
return ""
}
defer f.Close()
md5hash := md5.New()
if _, err := io.Copy(md5hash, f); err != nil {
fmt.Println("Copy", err)
return ""
}
has := md5hash.Sum(nil)
md5str := fmt.Sprintf("%x", has)
return md5str
}
go获取文件MD5
好耶,沙发还空着ヾ(≧▽≦*)o
Loading...
- 上一页
- 下一页