Skip to content

Instantly share code, notes, and snippets.

@sthorne
Last active August 29, 2015 14:15
Show Gist options
  • Save sthorne/d0fa9da8388d275ac635 to your computer and use it in GitHub Desktop.
Save sthorne/d0fa9da8388d275ac635 to your computer and use it in GitHub Desktop.
Go - MD5 File
package main
import (
"fmt"
"io/ioutil"
"crypto/md5"
"encoding/hex"
)
func main() {
f, e := ioutil.ReadFile("file.txt")
if e != nil {
panic(e)
}
h := md5.New()
h.Write(f)
b := h.Sum(nil)
fmt.Println(hex.EncodeToString(b))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment