mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 10:53:11 +02:00
24 lines
383 B
Go
24 lines
383 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"crypto/rand"
|
|
"testing"
|
|
)
|
|
|
|
func TestLionnessCorrectness(t *testing.T) {
|
|
var m [messageSize]byte
|
|
msg := []byte("hello")
|
|
copy(m[:], msg)
|
|
|
|
var key [securityParameter]byte
|
|
rand.Read(key[:])
|
|
|
|
cipherText := lionessEncode(key, m)
|
|
plainText := lionessDecode(key, cipherText)
|
|
|
|
if !bytes.Equal(m[:], plainText[:]) {
|
|
t.Fatalf("texts not equal")
|
|
}
|
|
}
|