From ab15322ad1cc167b3d556d97bbdd705ac9aeea30 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 8 Jan 2017 11:49:27 +0300 Subject: [PATCH] Use faster BLAKE2s implementation from golang.org/x/crypto This implementation contains SSE* related assembler code. Signed-off-by: Sergey Matveev --- cipher_suite.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cipher_suite.go b/cipher_suite.go index e66f7b5..a1d9468 100644 --- a/cipher_suite.go +++ b/cipher_suite.go @@ -10,9 +10,9 @@ import ( "hash" "io" - "github.com/devi/blake2/blake2s" "github.com/devi/chap" "github.com/minio/blake2b-simd" + "golang.org/x/crypto/blake2s" "golang.org/x/crypto/curve25519" ) @@ -201,5 +201,13 @@ var HashSHA512 HashFunc = hashFn{sha512.New, "SHA512"} // HashBLAKE2b is the BLAKE2b hash function. var HashBLAKE2b HashFunc = hashFn{blake2b.New512, "BLAKE2b"} +func blake2sNew() hash.Hash { + h, err := blake2s.New256(nil) + if err != nil { + panic(err) + } + return h +} + // HashBLAKE2s is the BLAKE2s hash function. -var HashBLAKE2s HashFunc = hashFn{blake2s.New, "BLAKE2s"} +var HashBLAKE2s HashFunc = hashFn{blake2sNew, "BLAKE2s"}