PHP » GoLang |
login |
register |
about
|
md5_filemd5_file[code] func md5_file(filename string) (string, error) { f, err := os.Open(filename) if err != nil { return "", err } defer f.Close() h := md5.New() if _, err := io.Copy(h, f); err != nil { return "", err } fmt.Sprintf("%x", h.Sum(nil)) } [/code] |