mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
crypto/hkdfchachapoly: Add testing seal to the test vector
This commit is contained in:
parent
2b5229dd5e
commit
3ae878b229
@ -36,12 +36,16 @@ func TestVector(t *testing.T) {
|
|||||||
nonce := make([]byte, 24)
|
nonce := make([]byte, 24)
|
||||||
nonce[0] = byteArr[0]
|
nonce[0] = byteArr[0]
|
||||||
|
|
||||||
|
// Test that we get the expected plaintext on open
|
||||||
plaintext, err := aead.Open(nil, nonce, ct, byteArr)
|
plaintext, err := aead.Open(nil, nonce, ct, byteArr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("%dth Open failed", i)
|
t.Errorf("%dth Open failed", i)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
assert.Equal(t, byteArr, plaintext)
|
assert.Equal(t, byteArr, plaintext)
|
||||||
|
// Test that sealing yields the expected ciphertext
|
||||||
|
ciphertext := aead.Seal(nil, nonce, plaintext, byteArr)
|
||||||
|
assert.Equal(t, ct, ciphertext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user