summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Wong <mimoo@users.noreply.github.com>2017-09-22 14:18:33 +0100
committerGitHub <noreply@github.com>2017-09-22 14:18:33 +0100
commita80962bd80c60a08aa0b38ef2f886421b2b7b780 (patch)
tree00bbe06a186cb5fcbeaae356b8d73c4d6953ffea
parent01cefa3e208b7260892d831b38b44bdbfd0f9f26 (diff)
downloadnoise-a80962bd80c60a08aa0b38ef2f886421b2b7b780.tar.xz
added golang's blake2b implementation
-rw-r--r--cipher_suite.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cipher_suite.go b/cipher_suite.go
index 252a102..d38f287 100644
--- a/cipher_suite.go
+++ b/cipher_suite.go
@@ -10,7 +10,7 @@ import (
"hash"
"io"
- "github.com/minio/blake2b-simd"
+ "golang.org/x/crypto/blake2b"
"golang.org/x/crypto/blake2s"
"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/crypto/curve25519"
@@ -202,8 +202,16 @@ var HashSHA256 HashFunc = hashFn{sha256.New, "SHA256"}
// HashSHA512 is the SHA-512 hash function.
var HashSHA512 HashFunc = hashFn{sha512.New, "SHA512"}
+func blake2bNew() hash.Hash {
+ h, err := blake2b.New512(nil)
+ if err != nil {
+ panic(err)
+ }
+ return h
+}
+
// HashBLAKE2b is the BLAKE2b hash function.
-var HashBLAKE2b HashFunc = hashFn{blake2b.New512, "BLAKE2b"}
+var HashBLAKE2b HashFunc = hashFn{blake2bNew, "BLAKE2b"}
func blake2sNew() hash.Hash {
h, err := blake2s.New256(nil)