golang調用CertUtil獲取文件md5

func getFileMD5(fileName string) string {
	cmd := exec.Command("cmd", "/C", "CertUtil", "-hashfile", fileName, "MD5|findstr", "/V", ":")
	out, _ := cmd.Output()
	cmd.Run()
	str := string(out[:])
	str = strings.Replace(str, " ", "", -1)
	return str[:32]
}
相關文章
相關標籤/搜索