AsymCrypt optimize + Symcrypt creation
This commit is contained in:
21
symcrypt_test.go
Normal file
21
symcrypt_test.go
Normal file
@ -0,0 +1,21 @@
|
||||
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.")
|
||||
}
|
Reference in New Issue
Block a user