Documentation ¶
Index ¶
- func AesCBCEncrypt(rawData []byte, key []byte) ([]byte, []byte, error)
- func AesCbcDecrypt(enData []byte, key []byte, iv []byte) ([]byte, error)
- func HashSha256(src string) string
- func Md5(str string) string
- func NullUnPadding(in []byte) []byte
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(data []byte) []byte
- func PasswordHash(password string) (string, error)
- func PasswordVerify(password, hash string) bool
- type AesEncryptor
- func (ae *AesEncryptor) Decrypt(data string, v interface{}) (err error)
- func (ae *AesEncryptor) DecryptString(data string) (string, error)
- func (ae *AesEncryptor) Encrypt(data interface{}) (string, error)
- func (ae *AesEncryptor) EncryptString(data string) (string, error)
- func (ae *AesEncryptor) GetSecret() string
- func (ae *AesEncryptor) SetSecret(secret string) *AesEncryptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesCBCEncrypt ¶
aes加密,填充秘钥key的16位,24,32分别对应AES-128, AES-192, or AES-256.
func HashSha256 ¶
func NullUnPadding ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func PasswordHash ¶
func PasswordVerify ¶
Types ¶
type AesEncryptor ¶
type AesEncryptor struct {
// contains filtered or unexported fields
}
func NewAesEncryptor ¶
func NewAesEncryptor(secret string) (aesEncryptor *AesEncryptor)
func (*AesEncryptor) Decrypt ¶
func (ae *AesEncryptor) Decrypt(data string, v interface{}) (err error)
func (*AesEncryptor) DecryptString ¶
func (ae *AesEncryptor) DecryptString(data string) (string, error)
func (*AesEncryptor) Encrypt ¶
func (ae *AesEncryptor) Encrypt(data interface{}) (string, error)
func (*AesEncryptor) EncryptString ¶
func (ae *AesEncryptor) EncryptString(data string) (string, error)
func (*AesEncryptor) GetSecret ¶
func (ae *AesEncryptor) GetSecret() string
func (*AesEncryptor) SetSecret ¶
func (ae *AesEncryptor) SetSecret(secret string) *AesEncryptor
Click to show internal directories.
Click to hide internal directories.