Documentation ¶
Index ¶
- func AesDecrypt(crypted, key []byte) ([]byte, error)
- func AesEncrypt(origData, key []byte) ([]byte, error)
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func ZeroPadding(ciphertext []byte, blockSize int) []byte
- func ZeroUnPadding(origData []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
********Aes 解密函数,注意key与加密函数必须一样
func AesEncrypt ¶
func main() { testAes() }
func testAes() { // AES-128。key长度:16, 24, 32 bytes 对应 AES-128, AES-192, AES-256 key := []byte("sfe023f_9fd&fwfl") result, err := AesEncrypt([]byte("polaris@studygolandfbfgbfb fb fbfxdb fb"), key) if err != nil { panic(err) } fmt.Println(result) fmt.Println(base64.StdEncoding.EncodeToString(result)) origData, err := AesDecrypt(result, key) if err != nil { panic(err) } fmt.Println(string(origData)) }
********Aes 加密函数,注意key必须是16/24/32 bytes
func PKCS5Padding ¶
func PKCS5UnPadding ¶
func ZeroUnPadding ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.