github.com/artisanhe/tools@v1.0.1-0.20210607022958-19a8fef2eb04/crypto/aes_ecb/aes_ecb_test.go (about)

     1  package aes_ecb
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestAESEncryptDecrypt(t *testing.T) {
     9  	fmt.Println("AES ECB加密解密测试........")
    10  	key := []byte("1234567890123456")
    11  	blickSize := 16
    12  	tool := NewAesTool(key, blickSize)
    13  	encryptData, _ := tool.Encrypt([]byte("abcdef"))
    14  	fmt.Println(encryptData)
    15  	decryptData, _ := tool.Decrypt(encryptData)
    16  	fmt.Println(string(decryptData))
    17  }