Documentation
¶
Index ¶
- Constants
- func AesCbcDecrypt(encrypted, key []byte) []byte
- func AesCbcEncrypt(data, key []byte) []byte
- func AesEcbDecrypt(encrypted, key []byte) []byte
- func AesEcbEncrypt(data, key []byte) []byte
- func Base62Decode(str string) int64
- func Base62Encode(number int64) string
- func Base64StdDecode(s string) string
- func Base64StdEncode(s string) string
- func Base64UrlSafeDecode(s string) (string, error)
- func Base64UrlSafeEncode(s string) string
- func CreateRsaKey(keySize int, priKeyFile, pubKeyFile string) error
- func DecodePrivateKey(pemContent []byte) (privateKey *rsa.PrivateKey, err error)
- func DecodePublicKey(pemContent []byte) (publicKey *rsa.PublicKey, err error)
- func DecryptDESECB4Base64(src, key string) string
- func DecryptDESECB4Hex(src, key string) string
- func EncryptDESECB2Base64(src, key string) string
- func EncryptDESECB2Hex(src, key string) string
- func GetAesKey(key []byte) []byte
- func GetDesKey(key []byte) []byte
- func HmacMd5(dataStr, key string) string
- func HmacSHA256(data, key string) string
- func HmacSHA256ForByte(data, key []byte) []byte
- func HmacSha1(dataStr, key string) string
- func HmacSha256V1(source, secret string) string
- func HmacSha512(dataStr, key string) string
- func HmacSha2562Byte(stringToSign string, secret string) []byte
- func MD5(s string) string
- func Md5To16(s string) string
- func MysqlAesDecrypt(src, key string) string
- func MysqlAesEncrypt(src, key string) string
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func Pkcs7Padding(origData []byte, blockSize int) []byte
- func Pkcs7UnPadding(origData []byte) []byte
- func RsaContent2PrivateKey(privateKeyContent string) (privateKey string)
- func RsaContent2PublicKey(publicKeyContent string) (publicKey string)
- func RsaDecrypt(data []byte, privateKeyFileName string) (error, []byte)
- func RsaEncrypt(data []byte, pubKeyFileName string) (error, []byte)
- func SHA256(s string) string
- func Sha1(str string) string
- func Sha1File(path string) (string, error)
- func Sha1V1(str string) string
- func Sha256ByByteV1(by []byte) string
- func Sha256V1(str string) string
- func Sha256V2(str string) string
- func Sha512(dataStr string) string
- func Sha2562Byte(str string) []byte
Constants ¶
View Source
const ShortChar = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Variables ¶
This section is empty.
Functions ¶
func Base62Decode ¶
func Base62Encode ¶
func Base64StdDecode ¶ added in v1.0.4
func Base64StdEncode ¶ added in v1.0.4
func Base64UrlSafeDecode ¶ added in v1.0.5
Base64UrlSafeDecode Base64安全解密
func Base64UrlSafeEncode ¶ added in v1.0.5
Base64UrlSafeEncode Base64安全加密
func CreateRsaKey ¶ added in v1.0.4
创建公钥、私钥
func DecodePrivateKey ¶ added in v1.0.5
func DecodePrivateKey(pemContent []byte) (privateKey *rsa.PrivateKey, err error)
pemContent=私钥内容
func DecodePublicKey ¶ added in v1.0.5
pemContent=公钥内容
func DecryptDESECB4Base64 ¶
des ECB hex解密: src := xcrypto.DecryptDESECB4Base64(xcrypto.EncryptDESECB2Base64("hello'!@123", "basesoft"),"basesoft")
func DecryptDESECB4Hex ¶
des ECB hex解密: src := xcrypto.DecryptDESECB4Hex(xcrypto.EncryptDESECB2Hex("123456", "basesoft"),"basesoft")
func EncryptDESECB2Base64 ¶
des ECB base64加密:xcrypto.EncryptDESECB2Base64("密码", "basesoft")
func HmacSHA256 ¶ added in v1.0.5
func HmacSHA256ForByte ¶ added in v1.0.5
func HmacSha256V1 ¶ added in v1.0.4
HmacSha256V1 HmacSHA256加密算法
func HmacSha512 ¶ added in v1.0.4
func HmacSha2562Byte ¶ added in v1.0.4
func MysqlAesDecrypt ¶ added in v1.0.5
解密,对应mysql功能: SELECT AES_DECRYPT(from_base64("irigEC0Ta0t8Bms/KO+Ocw=="), "abc123key")
func MysqlAesEncrypt ¶ added in v1.0.5
加密,对应mysql功能: SELECT to_base64(AES_ENCRYPT("helloworld", "abc123key"));
func PKCS5Padding ¶
func PKCS5UnPadding ¶
func Pkcs7Padding ¶ added in v1.0.4
func Pkcs7UnPadding ¶ added in v1.0.4
func RsaContent2PrivateKey ¶ added in v1.0.5
rsa私钥内容
func RsaContent2PublicKey ¶ added in v1.0.5
rsa公钥内容
func RsaDecrypt ¶ added in v1.0.4
通过私钥解密
func RsaEncrypt ¶ added in v1.0.4
通过公钥进行rsa加密
func Sha256ByByteV1 ¶
func Sha2562Byte ¶ added in v1.0.4
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.