This commit is contained in:
Meutel 2017-07-08 10:35:19 +02:00
parent 69c7da0c88
commit fd47df36b7
2 changed files with 24 additions and 0 deletions

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ longest-word/longest-word
statecsv/statecsv statecsv/statecsv
go-financial/go-financial go-financial/go-financial
my-fnv/my-fnv my-fnv/my-fnv
my-md5/my-md5

23
my-md5/main.go Normal file
View File

@ -0,0 +1,23 @@
package main
import "fmt"
import "crypto/md5"
import "io"
import "log"
import "os"
func main() {
if len(os.Args) < 2 {
log.Fatalln("Usage my-md5 file")
}
f, err := os.Open(os.Args[1])
if err != nil {
log.Fatalln(err)
}
defer f.Close()
h := md5.New()
io.Copy(h, f)
fmt.Printf("%x\n", h.Sum(nil))
}