mirror of
https://github.com/restic/restic.git
synced 2026-11-22 05:14:23 +00:00
crypto: Rename exported funcs and structs, cleanup
This commit is contained in:
1 parent
21dc6dd3db
commit
64f7d4d611
4 files changed
+39
-39
No files matched your search
+11
-11
@@ -17,7 +17,7 @@ import (
|
||||
var testLargeCrypto = flag.Bool("test.largecrypto", false, "also test crypto functions with large payloads")
|
||||
|
||||
func TestEncryptDecrypt(t *testing.T) {
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
tests := []int{5, 23, 2<<18 + 23, 1 << 20}
|
||||
if *testLargeCrypto {
|
||||
@@ -43,7 +43,7 @@ func TestEncryptDecrypt(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSmallBuffer(t *testing.T) {
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
size := 600
|
||||
data := make([]byte, size)
|
||||
@@ -65,7 +65,7 @@ func TestLargeEncrypt(t *testing.T) {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
for _, size := range []int{chunker.MaxSize, chunker.MaxSize + 1, chunker.MaxSize + 1<<20} {
|
||||
data := make([]byte, size)
|
||||
@@ -90,7 +90,7 @@ func BenchmarkEncryptWriter(b *testing.B) {
|
||||
size := 8 << 20 // 8MiB
|
||||
rd := RandomReader(23, size)
|
||||
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
b.ResetTimer()
|
||||
b.SetBytes(int64(size))
|
||||
@@ -108,7 +108,7 @@ func BenchmarkEncrypt(b *testing.B) {
|
||||
size := 8 << 20 // 8MiB
|
||||
data := make([]byte, size)
|
||||
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
buf := make([]byte, len(data)+crypto.Extension)
|
||||
|
||||
b.ResetTimer()
|
||||
@@ -123,7 +123,7 @@ func BenchmarkEncrypt(b *testing.B) {
|
||||
func BenchmarkDecryptReader(b *testing.B) {
|
||||
size := 8 << 20 // 8MiB
|
||||
buf := Random(23, size)
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
ciphertext := make([]byte, len(buf)+crypto.Extension)
|
||||
_, err := crypto.Encrypt(k, ciphertext, buf)
|
||||
@@ -145,7 +145,7 @@ func BenchmarkDecryptReader(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkEncryptDecryptReader(b *testing.B) {
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
size := 8 << 20 // 8MiB
|
||||
rd := RandomReader(23, size)
|
||||
@@ -176,7 +176,7 @@ func BenchmarkDecrypt(b *testing.B) {
|
||||
size := 8 << 20 // 8MiB
|
||||
data := make([]byte, size)
|
||||
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
ciphertext := restic.GetChunkBuf("BenchmarkDecrypt")
|
||||
defer restic.FreeChunkBuf("BenchmarkDecrypt", ciphertext)
|
||||
@@ -196,7 +196,7 @@ func BenchmarkDecrypt(b *testing.B) {
|
||||
}
|
||||
|
||||
func TestEncryptStreamWriter(t *testing.T) {
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
tests := []int{5, 23, 2<<18 + 23, 1 << 20}
|
||||
if *testLargeCrypto {
|
||||
@@ -230,7 +230,7 @@ func TestEncryptStreamWriter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDecryptStreamReader(t *testing.T) {
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
tests := []int{5, 23, 2<<18 + 23, 1 << 20}
|
||||
if *testLargeCrypto {
|
||||
@@ -264,7 +264,7 @@ func TestDecryptStreamReader(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEncryptWriter(t *testing.T) {
|
||||
k := crypto.GenerateKey()
|
||||
k := crypto.NewKey()
|
||||
|
||||
tests := []int{5, 23, 2<<18 + 23, 1 << 20}
|
||||
if *testLargeCrypto {
|
||||
|
||||
Reference in new issue
Block a user