Last active
August 29, 2015 14:15
-
-
Save sthorne/d0fa9da8388d275ac635 to your computer and use it in GitHub Desktop.
Go - MD5 File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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