This commit is contained in:
Meutel 2017-07-08 10:29:47 +02:00
parent 46da91f833
commit 69c7da0c88
2 changed files with 24 additions and 0 deletions

1
.gitignore vendored
View File

@ -34,3 +34,4 @@ upper-words/upper-words
longest-word/longest-word
statecsv/statecsv
go-financial/go-financial
my-fnv/my-fnv

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

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