Simplest form file uploader.
It just saves uploaded file from HTML form to the new file on the disk.
-Also it calculates BLAKE2s checksum, replying with it in the answer.
+Also it calculates BLAKE2b checksum, replying with it in the answer.
You can upload files with curl:
You can verify integrity locally:
- b2sum -a blake2s somedata.tar.gpg
+ b2sum -a blake2b somedata.tar.gpg
"os"
"time"
- "golang.org/x/crypto/blake2s"
+ "golang.org/x/crypto/blake2b"
"golang.org/x/net/netutil"
)
log.Println(r.RemoteAddr, "non file form field")
return
}
- h, err := blake2s.New256(nil)
+ h, err := blake2b.New256(nil)
if err != nil {
panic(err)
}
log.Println(r.RemoteAddr, fn, p.FileName(), n, sum, err)
return
}
- fmt.Fprintf(w, "bytes: %d\nBLAKE2s: %s\n", n, sum)
+ fmt.Fprintf(w, "Timestamp: %s\nBytes: %d\nBLAKE2b: %s\n", fn, n, sum)
log.Println(r.RemoteAddr, fn, p.FileName(), n, sum)
}