Documentation
¶
Index ¶
- Variables
- func AesGenKey(key []byte, typ ...string) []byte
- func DesGenKey(key []byte) []byte
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) []byte
- func ZeroPadding(ciphertext []byte, blockSize int) []byte
- func ZeroUnPadding(origData []byte) []byte
- type AesCBCCrypto
- type AesCrypto
- type AesECBCrypto
- type Codec
- type DesCBCCrypto
- type DesECBCrypto
Constants ¶
This section is empty.
Variables ¶
View Source
var AESKeyTypes = map[string]int{
`AES-128`: aes128KeyLen,
`AES-192`: aes192KeyLen,
`AES-256`: aes256KeyLen,
}
AESKeyTypes AES Key类型
Functions ¶
func NewECBDecrypter ¶
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.
func NewECBEncrypter ¶
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.
func PKCS5Padding ¶
func PKCS5UnPadding ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func ZeroPadding ¶
func ZeroUnPadding ¶
Types ¶
type AesCBCCrypto ¶
type AesCBCCrypto struct {
// contains filtered or unexported fields
}
func NewAesCBCCrypto ¶
func NewAesCBCCrypto(keyTypes ...string) *AesCBCCrypto
func (*AesCBCCrypto) Decode ¶
func (c *AesCBCCrypto) Decode(cryptedData, authKey string) string
func (*AesCBCCrypto) DecodeBytes ¶
func (c *AesCBCCrypto) DecodeBytes(cryptedData, authKey []byte) []byte
func (*AesCBCCrypto) Encode ¶
func (c *AesCBCCrypto) Encode(rawData, authKey string) string
func (*AesCBCCrypto) EncodeBytes ¶
func (c *AesCBCCrypto) EncodeBytes(rawData, authKey []byte) []byte
type AesECBCrypto ¶
type AesECBCrypto struct {
// contains filtered or unexported fields
}
func NewAesECBCrypto ¶
func NewAesECBCrypto(keyTypes ...string) *AesECBCrypto
func (*AesECBCrypto) Decode ¶
func (c *AesECBCrypto) Decode(cryptedData, authKey string) string
func (*AesECBCrypto) DecodeBytes ¶
func (c *AesECBCrypto) DecodeBytes(cryptedData, authKey []byte) []byte
func (*AesECBCrypto) Encode ¶
func (c *AesECBCrypto) Encode(rawData, authKey string) string
func (*AesECBCrypto) EncodeBytes ¶
func (c *AesECBCrypto) EncodeBytes(rawData, authKey []byte) []byte
type Codec ¶
type Codec interface {
Encode(rawData, authKey string) string
Decode(cryptedData, authKey string) string
EncodeBytes(rawData, authKey []byte) []byte
DecodeBytes(cryptedData, authKey []byte) []byte
}
var Default Codec = NewAesCrypto()
type DesCBCCrypto ¶
type DesCBCCrypto struct {
// contains filtered or unexported fields
}
func NewDesCBCCrypto ¶
func NewDesCBCCrypto() *DesCBCCrypto
func (*DesCBCCrypto) Decode ¶
func (d *DesCBCCrypto) Decode(cryptedStr, secret string) string
Decode DES CBC解密
func (*DesCBCCrypto) DecodeBytes ¶
func (d *DesCBCCrypto) DecodeBytes(crypted, secret []byte) []byte
func (*DesCBCCrypto) Encode ¶
func (d *DesCBCCrypto) Encode(text, secret string) string
Encode DES CBC加密
func (*DesCBCCrypto) EncodeBytes ¶
func (d *DesCBCCrypto) EncodeBytes(text, secret []byte) []byte
func (*DesCBCCrypto) GenKey ¶
func (d *DesCBCCrypto) GenKey(key []byte) []byte
type DesECBCrypto ¶
type DesECBCrypto struct {
// contains filtered or unexported fields
}
func NewDesECBCrypto ¶
func NewDesECBCrypto() *DesECBCrypto
func (*DesECBCrypto) Decode ¶
func (d *DesECBCrypto) Decode(crypted, secret string) string
func (*DesECBCrypto) DecodeBytes ¶
func (d *DesECBCrypto) DecodeBytes(crypted, secret []byte) []byte
func (*DesECBCrypto) Encode ¶
func (d *DesECBCrypto) Encode(text, secret string) string
func (*DesECBCrypto) EncodeBytes ¶
func (d *DesECBCrypto) EncodeBytes(text, secret []byte) []byte
func (*DesECBCrypto) GenKey ¶
func (d *DesECBCrypto) GenKey(key []byte) []byte
Click to show internal directories.
Click to hide internal directories.