Documentation
¶
Index ¶
- Constants
- Variables
- func AesDecryptCBC(encrypted, key, iv []byte, padding string) (decrypted []byte, err error)
- func AesDecryptCFB(encrypted, key, iv []byte, padding string) (decrypted []byte, err error)
- func AesDecryptECB(encrypted []byte, key []byte, padding string) (decrypted []byte, err error)
- func AesEncryptCBC(origData, key, iv []byte, padding string) (encrypted []byte, err error)
- func AesEncryptCFB(origData, key, iv []byte, padding string) (encrypted []byte, err error)
- func AesEncryptECB(origData []byte, key []byte, padding string) (encrypted []byte, err error)
- func DesDecryptCBC(encrypted, key, iv []byte, padding string) (decrypted []byte, err error)
- func DesDecryptCFB(encrypted, key, iv []byte, padding string) (decrypted []byte, err error)
- func DesDecryptECB(encrypted []byte, key []byte, padding string) (decrypted []byte, err error)
- func DesEncryptCBC(origData, key, iv []byte, padding string) (encrypted []byte, err error)
- func DesEncryptCFB(origData, key, iv []byte, padding string) (encrypted []byte, err error)
- func DesEncryptECB(origData []byte, key []byte, padding string) (encrypted []byte, err error)
- func PKCS5Padding(src []byte, blockSize int) []byte
- func PKCS5Unpadding(src []byte) []byte
- func PKCS7Padding(src []byte, blockSize int) []byte
- func PKCS7UnPadding(src []byte) []byte
- func Padding(padding string, src []byte, blockSize int) []byte
- func TripleDesDecryptCBC(encrypted, key, iv []byte, padding string) (decrypted []byte, err error)
- func TripleDesDecryptCFB(encrypted, key, iv []byte, padding string) (decrypted []byte, err error)
- func TripleDesDecryptECB(encrypted []byte, key []byte, padding string) (decrypted []byte, err error)
- func TripleDesEncryptCBC(origData, key, iv []byte, padding string) (encrypted []byte, err error)
- func TripleDesEncryptCFB(origData, key, iv []byte, padding string) (encrypted []byte, err error)
- func TripleDesEncryptECB(origData []byte, key []byte, padding string) (encrypted []byte, err error)
- func UnPadding(padding string, src []byte) []byte
- func ZerosPadding(src []byte, blockSize int) []byte
- func ZerosUnPadding(src []byte) []byte
- type Encrypt
- func (en *Encrypt) Base64Decrypt(encrypted string) (decrypted []byte, err error)
- func (en *Encrypt) Decrypt(encrypted []byte) (decrypted []byte, err error)
- func (en *Encrypt) Encrypt(origData []byte) (encrypted []byte, err error)
- func (en *Encrypt) EncryptBase64(origData []byte) string
- func (en *Encrypt) EncryptHex(origData []byte) string
- func (en *Encrypt) HexDecrypt(encrypted string) (decrypted []byte, err error)
Constants ¶
View Source
const ( AES_CBC = "AES_CBC" AES_ECB = "AES_ECB" AES_CFB = "AES_CFB" DES_CBC = "DES_CBC" DES_ECB = "DES_ECB" DES_CFB = "DES_CFB" DES3_CBC = "DES3_CBC" DES3_ECB = "DES3_ECB" DES3_CFB = "DES3_CFB" )
View Source
const PKCS5_PADDING = "PKCS5"
View Source
const PKCS7_PADDING = "PKCS7"
View Source
const ZEROS_PADDING = "ZEROS"
Variables ¶
View Source
var ErrIvLength16 = errors.New("invalid iv size must 16 bytes")
View Source
var ErrIvLength8 = errors.New("invalid iv size must 8 bytes")
View Source
var ErrNotFoundMode = errors.New("not found mode")
Functions ¶
func AesDecryptCBC ¶
func AesDecryptCFB ¶
func AesDecryptECB ¶
func AesEncryptCBC ¶
=================== CBC ======================
func AesEncryptCFB ¶
func AesEncryptECB ¶
=================== ECB ======================
func DesDecryptCBC ¶
func DesDecryptCFB ¶
func DesDecryptECB ¶
func DesEncryptCBC ¶
=================== CBC ======================
func DesEncryptCFB ¶
=================== CFB ======================
func DesEncryptECB ¶
=================== ECB ======================
func PKCS5Padding ¶
func PKCS5Unpadding ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func TripleDesDecryptCBC ¶
func TripleDesDecryptCFB ¶
func TripleDesDecryptECB ¶
func TripleDesEncryptCBC ¶
=================== CBC ======================
func TripleDesEncryptCFB ¶
=================== CFB ======================
func TripleDesEncryptECB ¶
=================== ECB ======================
func ZerosPadding ¶
func ZerosUnPadding ¶
Types ¶
type Encrypt ¶
func (*Encrypt) Base64Decrypt ¶
传入base64格式字符串解密
func (*Encrypt) EncryptBase64 ¶
加密生成base64格式的字符串
Click to show internal directories.
Click to hide internal directories.