encoding

package
v0.0.0-...-cb352a8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidBlock = errors.New("invalid block")
View Source
var ErrInvalidChecksum = errors.New("invalid checksum")
View Source
var ErrInvalidTimestamp = errors.New("invalid timestamp")

Functions

func AesDecodeString

func AesDecodeString(data string, pwd ...string) (string, error)

func AesDecodeStringByTimestamp

func AesDecodeStringByTimestamp(data string, pwd ...string) (string, error)

func AesDecrypt

func AesDecrypt(crypted, key []byte) (retBuf []byte, retErr error)

func AesDecryptByTimestamp

func AesDecryptByTimestamp(crypted, key []byte) (retBuf []byte, retErr error)

func AesDecryptIV

func AesDecryptIV(data []byte, key, iv []byte, padding ...string) (retData []byte, retErr error)

func AesECBDecrypt

func AesECBDecrypt(data, key []byte, padding ...string) (retBuffer []byte, retErr error)

func AesECBEncrypt

func AesECBEncrypt(data, key []byte, padding ...string) ([]byte, error)

func AesEncodeByKIV

func AesEncodeByKIV(data []byte, nonce string, key, iv []byte, hexOutput bool) ([]byte, error)

func AesEncodeString

func AesEncodeString(data string, mode string, pwd ...string) (string, error)

func AesEncrypt

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

func AesEncryptIV

func AesEncryptIV(data []byte, key, iv []byte, padding ...string) ([]byte, error)

func Base64Decode

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

func Base64Encode

func Base64Encode(src []byte) string

func Base64Encode2

func Base64Encode2(src []byte) []byte

func CompressZipFile

func CompressZipFile(files []*os.File, compreFile *os.File) (err error)

CompressZipFile CompressZipFile

func DesDecrypt

func DesDecrypt(crypted, key []byte, padding ...string) ([]byte, error)

func DesECBDecrypt

func DesECBDecrypt(crypted, key []byte, padding ...string) ([]byte, error)

key必须是8个字节

func DesECBEncrypt

func DesECBEncrypt(origData, key []byte, padding ...string) ([]byte, error)

key必须是8个字节

func DesEncrypt

func DesEncrypt(origData, key []byte, padding ...string) ([]byte, error)

func Hex2Bytes

func Hex2Bytes(str string) ([]byte, error)

func Md5

func Md5(in string) string

func Md516

func Md516(in string) string

func NewECBDecrypt

func NewECBDecrypt(b cipher.Block) cipher.BlockMode

func NewECBEncrypt

func NewECBEncrypt(b cipher.Block) cipher.BlockMode

func NewRSAKeyString

func NewRSAKeyString(bits int) (priKey string, pubKey string, retErr error)

func PKCS0Padding

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

func PKCS0UnPadding

func PKCS0UnPadding(origData []byte) []byte

func PKCS5Padding

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

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func PKCS7Padding

func PKCS7Padding(cipherText []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

func RSASignature

func RSASignature(plainText []byte, privateKeyStr string) ([]byte, error)

func RSAVerify

func RSAVerify(plainText, sigText []byte, pubKeyStr string) (bool, error)

func RsaDecode

func RsaDecode(privateKey string, text string) (string, error)

func RsaEncode

func RsaEncode(publicKey string, msg string) (string, error)

func SHA256

func SHA256(str string) string

func SaveRsaPrivateKey

func SaveRsaPrivateKey(privateKey *rsa.PrivateKey) (string, error)

func SaveRsaPublicKey

func SaveRsaPublicKey(publicKey *rsa.PublicKey) (string, error)

func TestRsa

func TestRsa()

func TrDesDecode

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

func TrDesDecodeString

func TrDesDecodeString(data string) (string, error)

func TrDesEncode

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

func TrDesEncodeString

func TrDesEncodeString(data string, mode string) (string, error)

mode: hex, base64, default base64

func TripleDesDecrypt

func TripleDesDecrypt(crypted, key []byte, padding ...string) ([]byte, error)

func TripleDesECBDecrypt

func TripleDesECBDecrypt(crypted, key []byte, padding ...string) ([]byte, error)

func TripleDesECBEncrypt

func TripleDesECBEncrypt(origData, key []byte, padding ...string) ([]byte, error)

func TripleDesEncrypt

func TripleDesEncrypt(origData, key []byte, padding ...string) ([]byte, error)

func UnZipFile

func UnZipFile(srcFile *os.File, dest string, topFilename *string) ([]string, error)

UnZipFile UnZipFile

@zipFile:压缩文件 @dest:解压之后文件保存路径

func Unzip

func Unzip(buffer *bytes.Buffer) string

func UnzipByte

func UnzipByte(buffer *bytes.Buffer) ([]byte, error)

func UnzipByte2

func UnzipByte2(buffer []byte) ([]byte, error)

func UnzipFileByPath

func UnzipFileByPath(tarFile, dest string) (string, []string, error)

UnzipFileByPath UnzipFileByPath

@tarFile:压缩文件路径 @dest:解压文件夹

func Zip

func Zip(buffer []byte) []byte

Types

type KIVHeader

type KIVHeader struct {
	Ver   int
	Time  int64
	Nonce string
}

func AesDecodeByKIV

func AesDecodeByKIV(data []byte, key, iv []byte, hexOutput bool) ([]byte, *KIVHeader, error)

Jump to

Keyboard shortcuts

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