From 8c7c24d7d63fd2c4b5216a1961bad468613ba461 Mon Sep 17 00:00:00 2001
From: Sergey Matveev <stargrave@stargrave.org>
Date: Thu, 30 May 2019 20:52:07 +0300
Subject: [PATCH] Move to BLAKE2b, as it is faster

---
 README               | 4 ++--
 src/uploader/main.go | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 9129971..823492a 100644
--- 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
diff --git a/src/uploader/main.go b/src/uploader/main.go
index c3f4e23..e2154cd 100644
--- a/src/uploader/main.go
+++ b/src/uploader/main.go
@@ -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)
 }
 
-- 
2.51.0