encryptor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(key, cipherText []byte) ([]byte, error)

AesDecrypt 解密

func AesDecryptFromBase58

func AesDecryptFromBase58(key []byte, cipherText string) ([]byte, error)

AesDecryptFromBase58 解密被base58过的密文

func AesDecryptFromBase64

func AesDecryptFromBase64(key []byte, cipherText string) ([]byte, error)

AesDecryptFromBase64 解密被base64过的密文

func AesEncrypt

func AesEncrypt(key, plainText []byte) ([]byte, error)

AesEncrypt 加密

func AesEncryptToBase58

func AesEncryptToBase58(key, plainText []byte) (string, error)

AesEncryptToBase58 加密并输出base58后的字符串

func AesEncryptToBase64

func AesEncryptToBase64(key, plainText []byte) (string, error)

AesEncryptToBase64 加密并输出base64后的字符串

func BlowfishDecrypt

func BlowfishDecrypt(key, ciphertext []byte) ([]byte, error)

BlowfishDecrypt 使用 Blowfish 算法解密字符串

func BlowfishDecryptFromBase58

func BlowfishDecryptFromBase58(key []byte, str string) ([]byte, error)

BlowfishDecryptFromBase58 使用 Blowfish 算法解密字符串

func BlowfishEncrypt

func BlowfishEncrypt(key, plaintext []byte) ([]byte, error)

BlowfishEncrypt 使用 Blowfish 算法加密字符串

func BlowfishEncryptToBase58

func BlowfishEncryptToBase58(key, plaintext []byte) (string, error)

BlowfishEncryptToBase58 使用 Blowfish 算法加密字符串

func DecodeBase64

func DecodeBase64(src string) ([]byte, error)

DecodeBase64 解码 Base64 字符串

func DecryptAesCBC

func DecryptAesCBC(key, cipherText []byte) ([]byte, error)

func DecryptBlowfishCBC

func DecryptBlowfishCBC(key, ciphertext []byte) ([]byte, error)

func DecryptFromBase64

func DecryptFromBase64(df decryptFunc, key []byte, src string) ([]byte, error)

DecryptFromBase64 解密被 Base64 过的密文

func EncodeBase64

func EncodeBase64(src []byte) string

EncodeBase64 编码为 Base64 字符串

func EncryptAesCBC

func EncryptAesCBC(key, plainText []byte) ([]byte, error)

func EncryptBlowfishCBC

func EncryptBlowfishCBC(key, plaintext []byte) ([]byte, error)

func EncryptToBase64

func EncryptToBase64(ef encryptFunc, key, src []byte) (string, error)

EncryptToBase64 加密并输出 Base64 字符串

func GenerateRSAPairKey

func GenerateRSAPairKey() (privateKeyBytes, publicKeyBytes []byte, err error)

GenerateRSAPairKey 生成 RSA 密钥对

func GenerateRSAPairKeyPEM

func GenerateRSAPairKeyPEM() (privateKeyPEM, publicKeyPEM []byte, err error)

GenerateRSAPairKeyPEM 生成 RSA 密钥对并保存为 PEM 格式

func GenerateUUID

func GenerateUUID() string

GenerateUUID 生成UUID

func GzipCompress

func GzipCompress(data []byte) ([]byte, error)

GzipCompress 对数据进行gzip压缩

func GzipDecompress

func GzipDecompress(data []byte) ([]byte, error)

GzipDecompress 对gzip压缩数据进行解压缩

func HashFile

func HashFile(h hash.Hash, path string) (string, error)

func HmacHash

func HmacHash(h func() hash.Hash, key, str string) string

func HmacMD5

func HmacMD5(key, str string) string

func MD5

func MD5(v string) string

func MD5File

func MD5File(path string) (string, error)

MD5File 计算文件的md5值

func RSAPrivateKeyFromFile

func RSAPrivateKeyFromFile(filename string) (*rsa.PrivateKey, error)

RSAPrivateKeyFromFile 从文件中读取 RSA 私钥

func RSAPrivateKeyFromPEM

func RSAPrivateKeyFromPEM(privateKeyPEM []byte) (*rsa.PrivateKey, error)

RSAPrivateKeyFromPEM 从 PEM 格式的私钥中解析 RSA 私钥

func RSAPublicKeyFromFile

func RSAPublicKeyFromFile(filename string) (*rsa.PublicKey, error)

RSAPublicKeyFromFile 从文件中读取 RSA 公钥

func RSAPublicKeyFromPEM

func RSAPublicKeyFromPEM(publicKeyPEM []byte) (*rsa.PublicKey, error)

RSAPublicKeyFromPEM 从 PEM 格式的公钥中解析 RSA 公钥

func SHA1

func SHA1(v string) string

func SHA1File

func SHA1File(path string) (string, error)

func SignRSA

func SignRSA(privateKey *rsa.PrivateKey, data []byte) ([]byte, error)

SignRSA 使用 RSA 私钥对数据进行签名

func SignRSASimple

func SignRSASimple(privateKey *rsa.PrivateKey, data []byte) ([]byte, error)

SignRSASimple 使用 RSA 私钥对数据进行签名

func UUID

func UUID() string

UUID generates a random UUID according to RFC 4122

func VerifyRSA

func VerifyRSA(publicKey *rsa.PublicKey, data, signature []byte) error

VerifyRSA 使用 RSA 公钥对签名进行验证

func VerifyRSASimple

func VerifyRSASimple(publicKey *rsa.PublicKey, data, signature []byte) error

VerifyRSASimple 使用 RSA 公钥对签名进行验证

Types

This section is empty.

Jump to

Keyboard shortcuts

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