Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AesEncrypt ¶
type AesEncrypt struct {
Key string
}
AesEncrypt 加密的定义结构
func (*AesEncrypt) Decrypt ¶
func (a *AesEncrypt) Decrypt(src []byte) (strDesc []byte, err error)
Decrypt 解密字符串
Example ¶
aesEnc := AesEncrypt{"1234334"} arrEncrypt, err := aesEnc.Encrypt([]byte("abcdef")) if err != nil { log.Println(arrEncrypt) return } aesDec := AesEncrypt{"1234335"} strMsg, err := aesDec.Decrypt(arrEncrypt) if err != nil { fmt.Printf("error password") return } fmt.Println(string(strMsg))
Output: error password
func (*AesEncrypt) Encrypt ¶
func (a *AesEncrypt) Encrypt(strMesg []byte) ([]byte, error)
Encrypt 加密字符串
Example ¶
aesEnc := AesEncrypt{"1234334"} arrEncrypt, err := aesEnc.Encrypt([]byte("abcdef")) if err != nil { log.Println(arrEncrypt) return } strMsg, err := aesEnc.Decrypt(arrEncrypt) if err != nil { log.Println(arrEncrypt) return } fmt.Println(string(strMsg))
Output: abcdef
Click to show internal directories.
Click to hide internal directories.