MCPcopy
hub / github.com/getsops/sops / TestRoundtripString

Function TestRoundtripString

aes/cipher_test.go:37–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestRoundtripString(t *testing.T) {
38 f := func(x, aad string) bool {
39 key := make([]byte, 32)
40 rand.Read(key)
41 s, err := NewCipher().Encrypt(x, key, aad)
42 if err != nil {
43 log.Println(err)
44 return false
45 }
46 d, err := NewCipher().Decrypt(s, key, aad)
47 if err != nil {
48 return false
49 }
50 return x == d
51 }
52 if err := quick.Check(f, nil); err != nil {
53 t.Error(err)
54 }
55}
56
57func TestRoundtripFloat(t *testing.T) {
58 key := []byte(strings.Repeat("f", 32))

Callers

nothing calls this directly

Calls 4

NewCipherFunction · 0.85
EncryptMethod · 0.65
DecryptMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected