brontide: replace aead/chacha20 with x/crypto/chacha20poly1305
This commit replaces aead’s chacha20 library with the official golang implementation. We should see a bit of a performance increase on amd64 as the assembly for the library uses the SIMD AVX2 instructions in the inner loop. In the future assembly will be written for other platforms, so we’ll see a performance increase across the board. Fixes #146.
This commit is contained in:
parent
f217093c00
commit
9234956a34
@ -9,9 +9,9 @@ import (
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
|
||||
"github.com/aead/chacha20"
|
||||
"github.com/roasbeef/btcd/btcec"
|
||||
)
|
||||
|
||||
@ -122,7 +122,10 @@ func (c *cipherState) Decrypt(associatedData, plainText, cipherText []byte) ([]b
|
||||
func (c *cipherState) InitializeKey(key [32]byte) {
|
||||
c.secretKey = key
|
||||
c.nonce = 0
|
||||
c.cipher = chacha20.NewChaCha20Poly1305(&c.secretKey)
|
||||
|
||||
// Safe to ignore the error here as our key is properly sized
|
||||
// (32-bytes).
|
||||
c.cipher, _ = chacha20poly1305.New(c.secretKey[:])
|
||||
}
|
||||
|
||||
// InitializeKeyWithSalt is identical to InitializeKey however it also sets the
|
||||
|
@ -47,6 +47,7 @@ import:
|
||||
- nacl/secretbox
|
||||
- ripemd160
|
||||
- scrypt
|
||||
- chacha20poly1305
|
||||
- package: golang.org/x/net
|
||||
subpackages:
|
||||
- context
|
||||
@ -56,7 +57,6 @@ import:
|
||||
version: a527838cac5e47260fb61ed155b9b24a6d6a10cc
|
||||
- package: github.com/grpc-ecosystem/grpc-gateway
|
||||
version: ^1.1.0
|
||||
- package: github.com/aead/chacha20
|
||||
- package: github.com/go-errors/errors
|
||||
- package: github.com/tv42/zbase32
|
||||
- package: github.com/awalterschulze/gographviz
|
||||
|
Loading…
Reference in New Issue
Block a user