zcpt

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 19 Imported by: 0

README

zcpt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptCBC

func AesDecryptCBC(encrypted, key []byte) (decrypted []byte, err error)

func AesDecryptCFB

func AesDecryptCFB(encrypted, key []byte) (decrypted []byte, err error)

func AesDecryptECB

func AesDecryptECB(encrypted, key []byte) (decrypted []byte, err error)

func AesEncryptCBC

func AesEncryptCBC(data, key []byte) (encrypted []byte, err error)

func AesEncryptCFB

func AesEncryptCFB(data, key []byte) (encrypted []byte, err error)

func AesEncryptECB

func AesEncryptECB(data, key []byte) (encrypted []byte, err error)

func EncodePrivateRSAKeyToPEM

func EncodePrivateRSAKeyToPEM(privateKey *rsa.PrivateKey) []byte

EncodePrivateRSAKeyToPEM @Description: 将私钥转换为PEM格式 @param privateKey @return []byte

func EncodePublicRSAKeyToPEM

func EncodePublicRSAKeyToPEM(publicKey *rsa.PublicKey) ([]byte, error)

EncodePublicRSAKeyToPEM @Description: 将公钥转换为PEM格式 @param publicKey @return []byte @return error

func GenerateRSAKey

func GenerateRSAKey(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)

GenerateRSAKey @Description: 生成RSA密钥对 @param bits @return *rsa.PrivateKey @return *rsa.PublicKey @return error

func Gzip added in v0.0.3

func Gzip(data []byte) []byte

func IsNil

func IsNil(v interface{}) bool

func Md5

func Md5(v any) string

func Md5String added in v0.0.6

func Md5String(v string) string

func NewPwd

func NewPwd(uid string, pwd string) string

NewPwd @Description: 用uid+pwd对密码加工,使密码数据每次不一样且不可逆 @param uid @param pwd @return string

func PKCS5Padding

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

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func RSADecrypt

func RSADecrypt(src, piv []byte) ([]byte, error)

RSADecrypt @Description: RSA解密 @param src @param filename @return []byte @return error

func RSAEncrypt

func RSAEncrypt(src, pub []byte) ([]byte, error)

RSAEncrypt @Description: RSA加密 @param src @param filename @return []byte @return error

func Sha256 added in v0.0.4

func Sha256(v any) string

func Sha256Stream added in v0.0.4

func Sha256Stream(r io.Reader) string

func UnGzip added in v0.0.3

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

func VerifyPwd

func VerifyPwd(uid string, cptPwd, pwd string) bool

VerifyPwd @Description: 校验密码 @param uid @param cptPwd 密文 @param pwd 明文 @return bool

Types

type Buffer added in v0.0.3

type Buffer struct {
	*bytes.Buffer
}

func NewBuff added in v0.0.3

func NewBuff() *Buffer

func (*Buffer) Clone added in v0.0.3

func (b *Buffer) Clone() []byte

func (*Buffer) Free added in v0.0.3

func (b *Buffer) Free()

func (*Buffer) WriteStringIf added in v0.0.3

func (b *Buffer) WriteStringIf(ok bool, s string) (int, error)

Jump to

Keyboard shortcuts

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