xcrypto

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const ShortChar = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Variables

This section is empty.

Functions

func AesCbcDecrypt added in v1.0.4

func AesCbcDecrypt(encrypted, key []byte) []byte

aes cbc解密

func AesCbcEncrypt added in v1.0.4

func AesCbcEncrypt(data, key []byte) []byte

aes cbc加密

func AesEcbDecrypt added in v1.0.4

func AesEcbDecrypt(encrypted, key []byte) []byte

aes ecb解密

func AesEcbEncrypt added in v1.0.4

func AesEcbEncrypt(data, key []byte) []byte

aes ecb加密

func Base62Decode

func Base62Decode(str string) int64

func Base62Encode

func Base62Encode(number int64) string

func Base64StdDecode added in v1.0.4

func Base64StdDecode(s string) string

func Base64StdEncode added in v1.0.4

func Base64StdEncode(s string) string

func CreateRsaKey added in v1.0.4

func CreateRsaKey(keySize int, priKeyFile, pubKeyFile string) error

创建公钥、私钥

func DecryptDESECB4Base64

func DecryptDESECB4Base64(src, key string) string

des ECB hex解密: src := xcrypto.DecryptDESECB4Base64(xcrypto.EncryptDESECB2Base64("hello'!@123", "basesoft"),"basesoft")

func DecryptDESECB4Hex

func DecryptDESECB4Hex(src, key string) string

des ECB hex解密: src := xcrypto.DecryptDESECB4Hex(xcrypto.EncryptDESECB2Hex("123456", "basesoft"),"basesoft")

func EncryptDESECB2Base64

func EncryptDESECB2Base64(src, key string) string

des ECB base64加密:xcrypto.EncryptDESECB2Base64("密码", "basesoft")

func EncryptDESECB2Hex

func EncryptDESECB2Hex(src, key string) string

des ECB hex加密

func GetAesKey added in v1.0.4

func GetAesKey(key []byte) []byte

通过内容生成16位长度的aes key

func GetDesKey added in v1.0.4

func GetDesKey(key []byte) []byte

通过内容生成8位长度的des key

func HmacMd5 added in v1.0.4

func HmacMd5(dataStr, key string) string

func HmacSha1 added in v1.0.4

func HmacSha1(dataStr, key string) string

func HmacSha2562Byte added in v1.0.4

func HmacSha2562Byte(stringToSign string, secret string) []byte

func HmacSha256V1 added in v1.0.4

func HmacSha256V1(source, secret string) string

HmacSha256V1 HmacSHA256加密算法

func HmacSha512 added in v1.0.4

func HmacSha512(dataStr, key string) string

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func Pkcs7Padding added in v1.0.4

func Pkcs7Padding(origData []byte, blockSize int) []byte

func Pkcs7UnPadding added in v1.0.4

func Pkcs7UnPadding(origData []byte) []byte

func RsaDecrypt added in v1.0.4

func RsaDecrypt(data []byte, privateKeyFileName string) (error, []byte)

通过私钥解密

func RsaEncrypt added in v1.0.4

func RsaEncrypt(data []byte, pubKeyFileName string) (error, []byte)

通过公钥进行rsa加密

func Sha1

func Sha1(str string) string

func Sha1File

func Sha1File(path string) (string, error)

类似php的sha1_file()

func Sha1V1

func Sha1V1(str string) string

func Sha2562Byte added in v1.0.4

func Sha2562Byte(str string) []byte

func Sha256ByByteV1

func Sha256ByByteV1(by []byte) string

func Sha256V1

func Sha256V1(str string) string

func Sha256V2 added in v1.0.4

func Sha256V2(str string) string

func Sha512 added in v1.0.4

func Sha512(dataStr string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL