yakshell

package
v1.3.6-beta2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DecryptMap = map[string]func(raw, key []byte) ([]byte, error){
	"": func(raw, key []byte) ([]byte, error) {
		return raw, nil
	},
	ypb.EncMode_Raw.String(): func(raw, key []byte) ([]byte, error) {
		return raw, nil
	},
	ypb.EncMode_XorBase64.String(): func(raw, key []byte) ([]byte, error) {
		return XorBase64Decode(raw, key)
	},
	ypb.EncMode_Base64.String(): func(raw, key []byte) ([]byte, error) {
		return codec.DecodeBase64(string(raw))
	},
	ypb.EncMode_AesRaw.String(): func(raw, key []byte) ([]byte, error) {
		return codec.AESECBDecrypt(raw, aesKeyPaddingWithZero(key), nil)
	},
	ypb.EncMode_AesBase64.String(): func(raw, key []byte) ([]byte, error) {
		bytes, err := codec.DecodeBase64(string(raw))
		if err != nil {
			return nil, err
		}
		return codec.AESECBDecrypt(aesKeyPaddingWithZero(key), bytes, nil)
	},
}
View Source
var EncryptMap = map[string]func(raw, key []byte) ([]byte, error){
	"": func(raw, key []byte) ([]byte, error) {
		return raw, nil
	},
	ypb.EncMode_Raw.String(): func(raw, key []byte) ([]byte, error) {
		return raw, nil
	},
	ypb.EncMode_XorBase64.String(): func(raw, key []byte) ([]byte, error) {
		return XorBase64Encode(raw, key)
	},
	ypb.EncMode_Base64.String(): func(raw, key []byte) ([]byte, error) {
		return []byte(codec.EncodeBase64(raw)), nil
	},

	ypb.EncMode_AesRaw.String(): func(raw, key []byte) ([]byte, error) {
		return codec.AESECBEncrypt(aesKeyPaddingWithZero(key), raw, nil)

	},
	ypb.EncMode_AesBase64.String(): func(raw, key []byte) ([]byte, error) {
		bytes, err := codec.AESECBEncrypt(aesKeyPaddingWithZero(key), raw, nil)
		if err != nil {
			return nil, err
		}
		return []byte(codec.EncodeBase64(bytes)), nil
	},
}

Functions

func Decryption

func Decryption(data, key []byte, deMode string) ([]byte, error)

func Encryption

func Encryption(data, key []byte, encMode string) ([]byte, error)

func XorBase64Decode

func XorBase64Decode(raw, key []byte) ([]byte, error)

func XorBase64Encode

func XorBase64Encode(raw, key []byte) ([]byte, error)

Types

type Param

type Param map[string]string

func (Param) Serialize

func (p Param) Serialize() string

Serialize 当是session mode的时候进行使用

Jump to

Keyboard shortcuts

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