fix hash file

This commit is contained in:
Zack Scholl 2018-09-21 21:13:46 -07:00
parent 274fab92a1
commit 828f83601d
2 changed files with 6 additions and 3 deletions

View File

@ -89,8 +89,9 @@ func receive(c *websocket.Conn, codephrase string) (err error) {
return err
}
// await file
f, err := os.Create("out")
f, err := os.Create(fstats.Name)
if err != nil {
log.Error(err)
return err
}
bytesWritten := 0
@ -149,8 +150,9 @@ func receive(c *websocket.Conn, codephrase string) (err error) {
bar.Finish()
// check hash
hash256, err := utils.HashFile("out")
hash256, err := utils.HashFile(fstats.Name)
if err != nil {
log.Error(err)
return err
}

View File

@ -6,8 +6,9 @@ import (
"os"
)
// HashFile returns the md5 hash of a file
func HashFile(fname string) (hash256 []byte, err error) {
f, err := os.Open("file.txt")
f, err := os.Open(fname)
if err != nil {
return
}