Documentation
¶
Overview ¶
Package cryptor implements some util functions to encrypt and decrypt. Note: 1. for aes crypt function, the `key` param length should be 16, 24 or 32. if not, will panic.
Package cryptor implements some util functions to encrypt and decrypt. Contain base64, hmac, sha, aes, des, and rsa
Package cryptor implements some util functions to encrypt and decrypt.
Package cryptor implements some util functions to encrypt and decrypt.
Index ¶
- func AesCbcDecrypt(data, key []byte) []byte
- func AesCbcEncrypt(data, key []byte) []byte
- func AesCfbDecrypt(encrypted, key []byte) []byte
- func AesCfbEncrypt(data, key []byte) []byte
- func AesCtrCrypt(data, key []byte) []byte
- func AesEcbDecrypt(encrypted, key []byte) []byte
- func AesEcbEncrypt(data, key []byte) []byte
- func AesOfbDecrypt(data, key []byte) []byte
- func AesOfbEncrypt(data, key []byte) []byte
- func Base64StdDecode(s string) string
- func Base64StdEncode(s string) string
- func DesCbcDecrypt(encrypted, key []byte) []byte
- func DesCbcEncrypt(data, key []byte) []byte
- func DesCfbDecrypt(encrypted []byte, key []byte) []byte
- func DesCfbEncrypt(data, key []byte) []byte
- func DesCtrCrypt(data, key []byte) []byte
- func DesEcbDecrypt(encrypted []byte, key []byte) []byte
- func DesEcbEncrypt(data, key []byte) []byte
- func DesOfbDecrypt(data, key []byte) []byte
- func DesOfbEncrypt(data, key []byte) []byte
- func GenerateRsaKey(keySize int, priKeyFile, publicKeyFile string) error
- func HmacMd5(data, key string) string
- func HmacSha1(data, key string) string
- func HmacSha256(data, key string) string
- func HmacSha512(data, key string) string
- func Md5File(filename string) (string, error)
- func Md5String(s string) string
- func RsaDecrypt(data []byte, priKeyFileName string) []byte
- func RsaEncrypt(data []byte, pubKeyFileName string) []byte
- func Sha1(data string) string
- func Sha256(data string) string
- func Sha512(data string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesCbcDecrypt ¶
AesCbcDecrypt decrypted data with key use AES CBC algorithm len(key) should be 16,24 or 32
func AesCbcEncrypt ¶
AesCbcEncrypt encrypt data with key use Ars CBC algorithm len(key) should be 16,24 or 32
func AesCfbDecrypt ¶
AesCfbDecrypt decrypt data with key use AES CFB algorithm len(encrypted) should be greater than 16, len(key) should be 16,24 or 32
func AesCfbEncrypt ¶
AesCfbEncrypt encrypt data with key use AES CFB algorithm len(key) should be 16,24 or 32
func AesCtrCrypt ¶
AesCtrCrypt encrypt data with key use AES CRT algorithm len(key) should be 16,24 or 32
func AesEcbDecrypt ¶
AesEcbDecrypt decrypt data with key use AES ECB algorithm
func AesEcbEncrypt ¶
AesEcbEncrypt encrypt data with key use AES ECB algorithm len(key) should be 16,24, or 32
func AesOfbDecrypt ¶
AesOfbDecrypt decrypt data with key use AES OFB algorithm len(key) should be 16, 24 or 32
func AesOfbEncrypt ¶
AesOfbEncrypt encrypt data with key use AES OFB algorithm len(key) should be 16,24 or 32
func Base64StdDecode ¶
Base64StdDecode decode a base64 encoded string
func Base64StdEncode ¶
Base64StdEncode encode string with base64 encoding
func DesCbcDecrypt ¶
DesCbcDecrypt decrypt data with key use DES CBC algorithm len(key) should be 8
func DesCbcEncrypt ¶
DesCbcEncrypt encrypt data with key use DES CBC algorithm len(key) should be 8
func DesCfbDecrypt ¶
DesCfbDecrypt decrypts data with key use DES CFB algorithm len(encrypted) should be greater than 16,len(key) should be 8
func DesCfbEncrypt ¶
DesCfbEncrypt encrypt data with key use DES CFB algorithm len(key) should be 8
func DesCtrCrypt ¶
DesCtrCrypt encrypt data with key use DES CTR algorithm len(key) should be 8
func DesEcbDecrypt ¶
DesEcbDecrypt decrypt data with key use DES ECB algorithm len(key) should be 8
func DesEcbEncrypt ¶
DesEcbEncrypt encrypt data with use DES ECB algorithm len(key) should be 8
func DesOfbDecrypt ¶
AesOfbDecrypt decrypt data with key use DES OFB algorithm len(key) should be 8
func DesOfbEncrypt ¶
DesOfbEncrypt encrypt data with key use DES OFB algorithm len(key) should be 16,24 or 32
func GenerateRsaKey ¶
GenerateRsaKey make a rsa private key,and return key file name Generated key file is `rsa_private.pem` and `rsa_public.pem` in current path
func HmacSha256 ¶
HmacSha256 return the hmac hash of string use sha256
func HmacSha512 ¶
HmacSha512 returns the hmac hash of string use sha512
func RsaDecrypt ¶
RsaDecrypt decrypt data with rsa algorithm
func RsaEncrypt ¶
RsaEncrypt encrypt data with rsa algorithm
Types ¶
This section is empty.