diff --git a/encryption_aead/encryption_test.go b/encryption_aead/encryption_test.go index 226a4b4..6e15a66 100644 --- a/encryption_aead/encryption_test.go +++ b/encryption_aead/encryption_test.go @@ -44,8 +44,8 @@ func BenchmarkEncryptAEAD(b *testing.B) { aes256GcmKey := utils.RandBytes(b, 32) aes256GcmNonce := utils.RandBytes(b, 12) - aes128GcmKey := utils.RandBytes(b, 16) - aes128GcmNonce := utils.RandBytes(b, 12) + // aes128GcmKey := utils.RandBytes(b, 16) + // aes128GcmNonce := utils.RandBytes(b, 12) for _, size := range BENCHMARKS { benchmarkEncrypt(b, size, "XChaCha20_BLAKE3", newXChaCha20Blake3Cipher(b, xChaCha20Key), xChaCha20Nonce, additionalData) @@ -53,7 +53,7 @@ func BenchmarkEncryptAEAD(b *testing.B) { benchmarkEncrypt(b, size, "XChaCha20_Poly1305", newXChaCha20Poly1305Cipher(b, xChaCha20Key), xChaCha20Nonce, additionalData) benchmarkEncrypt(b, size, "ChaCha20_Poly1305", newChaCha20Poly1305Cipher(b, chaCha20Key), chaCha20Nonce, additionalData) benchmarkEncrypt(b, size, "AES_256_GCM", newAesGcmCipher(b, aes256GcmKey), aes256GcmNonce, additionalData) - benchmarkEncrypt(b, size, "AES_128_GCM", newAesGcmCipher(b, aes128GcmKey), aes128GcmNonce, additionalData) + // benchmarkEncrypt(b, size, "AES_128_GCM", newAesGcmCipher(b, aes128GcmKey), aes128GcmNonce, additionalData) benchmarkEncrypt(b, size, "XChaCha20_SHA256", newXChaCha20Sha256Cipher(b, xChaCha20Key), xChaCha20Nonce, additionalData) } } @@ -70,8 +70,8 @@ func BenchmarkDecryptAEAD(b *testing.B) { aes256GcmKey := utils.RandBytes(b, 32) aes256GcmNonce := utils.RandBytes(b, 12) - aes128GcmKey := utils.RandBytes(b, 16) - aes128GcmNonce := utils.RandBytes(b, 12) + // aes128GcmKey := utils.RandBytes(b, 16) + // aes128GcmNonce := utils.RandBytes(b, 12) for _, size := range BENCHMARKS { benchmarkDecrypt(b, size, "XChaCha20_BLAKE3", newXChaCha20Blake3Cipher(b, xChaCha20Key), xChaCha20Nonce, additionalData) @@ -79,7 +79,7 @@ func BenchmarkDecryptAEAD(b *testing.B) { benchmarkDecrypt(b, size, "XChaCha20_Poly1305", newXChaCha20Poly1305Cipher(b, xChaCha20Key), xChaCha20Nonce, additionalData) benchmarkDecrypt(b, size, "ChaCha20_Poly1305", newChaCha20Poly1305Cipher(b, chaCha20Key), chaCha20Nonce, additionalData) benchmarkDecrypt(b, size, "AES_256_GCM", newAesGcmCipher(b, aes256GcmKey), aes256GcmNonce, additionalData) - benchmarkDecrypt(b, size, "AES_128_GCM", newAesGcmCipher(b, aes128GcmKey), aes128GcmNonce, additionalData) + // benchmarkDecrypt(b, size, "AES_128_GCM", newAesGcmCipher(b, aes128GcmKey), aes128GcmNonce, additionalData) benchmarkDecrypt(b, size, "XChaCha20_SHA256", newXChaCha20Sha256Cipher(b, xChaCha20Key), xChaCha20Nonce, additionalData) } } diff --git a/encryption_unauthenticated/encryption_test.go b/encryption_unauthenticated/encryption_test.go index f7031ab..9d34a75 100644 --- a/encryption_unauthenticated/encryption_test.go +++ b/encryption_unauthenticated/encryption_test.go @@ -133,7 +133,7 @@ type xChaCha12Cipher struct { } func newXChaCha12Cipher(b *testing.B, key, nonce []byte) xChaCha12Cipher { - cipher, err := xchacha12.NewCipher(key, nonce) + cipher, err := xchacha12.New(key, nonce) if err != nil { b.Error(err) } diff --git a/go.mod b/go.mod index af2c72c..2d9aceb 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/DataDog/zstd v1.5.5 github.com/akamensky/base58 v0.0.0-20210829145138-ce8bf8802e8f - github.com/bloom42/stdx v0.0.0-20240120085940-f464ec6e679c + github.com/bloom42/stdx v0.0.0-20240121092629-09ed451d9a75 github.com/cespare/xxhash/v2 v2.2.0 github.com/golang/snappy v0.0.4 github.com/jotfs/fastcdc-go v0.2.0 diff --git a/go.sum b/go.sum index d177904..36a95c6 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/akamensky/base58 v0.0.0-20210829145138-ce8bf8802e8f h1:z8MkSJCUyTmW5YQlxsMLBlwA7GmjxC7L4ooicxqnhz8= github.com/akamensky/base58 v0.0.0-20210829145138-ce8bf8802e8f/go.mod h1:UdUwYgAXBiL+kLfcqxoQJYkHA/vl937/PbFhZM34aZs= -github.com/bloom42/stdx v0.0.0-20240120085940-f464ec6e679c h1:mpkg67NdWIwxLhMx7TNteYZy/wcg0frvZse1wuVap8w= -github.com/bloom42/stdx v0.0.0-20240120085940-f464ec6e679c/go.mod h1:zZWdLGQq1BX7GoDuZZPyyE0WUTy5MmNtPB6+8TB6Mf0= +github.com/bloom42/stdx v0.0.0-20240121092629-09ed451d9a75 h1:06wdAsXTKv/vD2RiTsylrnmZnYNv0bTW49PLEN/Ywtw= +github.com/bloom42/stdx v0.0.0-20240121092629-09ed451d9a75/go.mod h1:zZWdLGQq1BX7GoDuZZPyyE0WUTy5MmNtPB6+8TB6Mf0= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= diff --git a/hashing/hashing_test.go b/hashing/hashing_test.go index 2df3f82..fa09e66 100644 --- a/hashing/hashing_test.go +++ b/hashing/hashing_test.go @@ -33,8 +33,8 @@ func BenchmarkHashing(b *testing.B) { for _, size := range benchmarks { benchmarkHasher(size, "sha256", sha256Hasher{}, b) - benchmarkHasher(size, "zeebo_blake3_256", zeeboBlake3Hasher{}, b) - benchmarkHasher(size, "lukechampine_blake3_256", lukechampineBlake3Hasher{}, b) + benchmarkHasher(size, "zeebo_blake3", zeeboBlake3Hasher{}, b) + benchmarkHasher(size, "lukechampine_blake3", lukechampineBlake3Hasher{}, b) benchmarkHasher(size, "blake2b_256", blake2bHasher{}, b) benchmarkHasher(size, "blake2s_256", blake2sHasher{}, b) // benchmarkHasher("sha512/256", sha512_256Hasher{}, b) @@ -42,8 +42,8 @@ func BenchmarkHashing(b *testing.B) { benchmarkHasher(size, "sha1", sha1Hasher{}, b) benchmarkHasher(size, "sha2_512", sha512Hasher{}, b) - benchmarkHasher(size, "zeebo_blake3_512", zeeboBlake3_512Hasher{}, b) - benchmarkHasher(size, "lukechampine_blake3_512", lukechampineBlake3_512Hasher{}, b) + // benchmarkHasher(size, "zeebo_blake3_512", zeeboBlake3_512Hasher{}, b) + // benchmarkHasher(size, "lukechampine_blake3_512", lukechampineBlake3_512Hasher{}, b) benchmarkHasher(size, "blake2b_512", blake2b512Hasher{}, b) benchmarkHasher(size, "sha3_512", sha3_512Hasher{}, b) } @@ -67,11 +67,11 @@ func (lukechampineBlake3Hasher) Hash(input []byte) { lukechampineblake3.Sum256(input) } -type lukechampineBlake3_512Hasher struct{} +// type lukechampineBlake3_512Hasher struct{} -func (lukechampineBlake3_512Hasher) Hash(input []byte) { - lukechampineblake3.Sum512(input) -} +// func (lukechampineBlake3_512Hasher) Hash(input []byte) { +// lukechampineblake3.Sum512(input) +// } type zeeboBlake3Hasher struct{} @@ -79,11 +79,11 @@ func (zeeboBlake3Hasher) Hash(input []byte) { zeeboblake3.Sum256(input) } -type zeeboBlake3_512Hasher struct{} +// type zeeboBlake3_512Hasher struct{} -func (zeeboBlake3_512Hasher) Hash(input []byte) { - zeeboblake3.Sum512(input) -} +// func (zeeboBlake3_512Hasher) Hash(input []byte) { +// zeeboblake3.Sum512(input) +// } type blake2sHasher struct{} diff --git a/kdf/kdf_test.go b/kdf/kdf_test.go index dbfdb14..58d4830 100644 --- a/kdf/kdf_test.go +++ b/kdf/kdf_test.go @@ -75,7 +75,7 @@ func (lukechampineBlake3_512KDF) DeriveKey(secret, info, out []byte) { type zeeboBlake3KDF struct{} func (zeeboBlake3KDF) DeriveKey(secret, info, out []byte) { - zeeboblake3.DeriveKey(string(info), secret, out) + zeeboblake3.DeriveKey(string(info), secret, out[:0]) } type zeeboBlake3_512KDF struct{}