aes_test.go 642 B

123456789101112131415161718192021222324252627282930
  1. package service
  2. import (
  3. "fmt"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestService_Encrypt(t *testing.T) {
  8. Convey("Encrypt param ", t, func() {
  9. input := []byte("13122119298")
  10. res, err := Encrypt(input)
  11. ShouldBeNil(err)
  12. ShouldNotBeNil(res)
  13. fmt.Printf("(%+v) \n", res)
  14. })
  15. }
  16. func TestService_Decrypt(t *testing.T) {
  17. Convey("Decrypt param ", t, func() {
  18. input := []byte{70, 251, 31, 100, 140, 98, 156, 101, 27, 21, 201, 100, 159, 107, 90, 147}
  19. fmt.Printf("input is (%+v) \n", input)
  20. res, err := Decrypt(input)
  21. ShouldBeNil(err)
  22. ShouldNotBeNil(res)
  23. fmt.Printf("(%+v) \n", string(res))
  24. })
  25. }