22 lines
518 B
Go
22 lines
518 B
Go
package meowlib
|
|
|
|
import (
|
|
"log"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSymEncryptDecrypt(t *testing.T) {
|
|
foo := []byte("!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~")
|
|
encMess, err := SymEncrypt("mysecretpassword", foo)
|
|
if err != nil {
|
|
log.Println(err.Error())
|
|
}
|
|
decMess, err2 := SymDecrypt("mysecretpassword", encMess)
|
|
if err2 != nil {
|
|
log.Println(err2.Error())
|
|
}
|
|
assert.Equal(t, foo, decMess, "The two messages should be the same.")
|
|
}
|