]> Sergey Matveev's repositories - uploader.git/commitdiff
Move to BLAKE2b, as it is faster
authorSergey Matveev <stargrave@stargrave.org>
Thu, 30 May 2019 17:52:07 +0000 (20:52 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 30 May 2019 17:52:07 +0000 (20:52 +0300)
README
src/uploader/main.go

diff --git a/README b/README
index 912997137379f897d1f7abfa415318840bc7979f..823492a49f8895b01a55c1ec6d3b0b1b2b8fad4b 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 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:
 
@@ -8,4 +8,4 @@ You can upload files with curl:
 
 You can verify integrity locally:
 
-    b2sum -a blake2s somedata.tar.gpg
+    b2sum -a blake2b somedata.tar.gpg
index c3f4e23f44044b5f9d4792a12837389eda19511b..e2154cdc57df52e83648cc9a4fb5cbca0dabe083 100644 (file)
@@ -18,7 +18,7 @@ import (
        "os"
        "time"
 
-       "golang.org/x/crypto/blake2s"
+       "golang.org/x/crypto/blake2b"
        "golang.org/x/net/netutil"
 )
 
@@ -57,7 +57,7 @@ func upload(w http.ResponseWriter, r *http.Request) {
                log.Println(r.RemoteAddr, "non file form field")
                return
        }
-       h, err := blake2s.New256(nil)
+       h, err := blake2b.New256(nil)
        if err != nil {
                panic(err)
        }
@@ -86,7 +86,7 @@ func upload(w http.ResponseWriter, r *http.Request) {
                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)
 }