crypto

package
v0.10.3-pre Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidDocument invalid document err
	ErrInvalidDocument = errors.New("invalid document")

	//ErrInvalidRoot data at the root level is invalid err
	ErrInvalidRoot = errors.New("data at the root level is invalid")
)
View Source
var HashTypes = map[string]crypto.Hash{
	"MD4":         crypto.MD4,
	"MD5":         crypto.MD5,
	"SHA1":        crypto.SHA1,
	"SHA224":      crypto.SHA224,
	"SHA256":      crypto.SHA256,
	"SHA384":      crypto.SHA384,
	"SHA512":      crypto.SHA512,
	"MD5SHA1":     crypto.MD5SHA1,
	"RIPEMD160":   crypto.RIPEMD160,
	"SHA3_224":    crypto.SHA3_224,
	"SHA3_256":    crypto.SHA3_256,
	"SHA3_384":    crypto.SHA3_384,
	"SHA3_512":    crypto.SHA3_512,
	"SHA512_224":  crypto.SHA512_224,
	"SHA512_256":  crypto.SHA512_256,
	"BLAKE2s_256": crypto.BLAKE2s_256,
	"BLAKE2b_256": crypto.BLAKE2b_256,
	"BLAKE2b_384": crypto.BLAKE2b_384,
	"BLAKE2b_512": crypto.BLAKE2b_512,
}

HashTypes string

Functions

func Base64AESDecode

func Base64AESDecode(key []byte, cryptoText string) (string, error)

Base64AESDecode AES decode

func Base64AESEncode

func Base64AESEncode(key []byte, text string) (string, error)

Base64AESEncode AES encode

func Hash

func Hash(hash crypto.Hash, value string) (string, error)

Hash string

func Hmac added in v0.10.1

func Hmac(hash crypto.Hash, value string, key string, encoding ...string) (string, error)

Hmac the Keyed-Hash Message Authentication Code (HMAC)

func ProcessHash

func ProcessHash(process *gou.Process) interface{}

ProcessHash yao.crypto.hash Crypto Hash Args[0] string: the hash function name. MD4/MD5/SHA1/SHA224/SHA256/SHA384/SHA512/MD5SHA1/RIPEMD160/SHA3_224/SHA3_256/SHA3_384/SHA3_512/SHA512_224/SHA512_256/BLAKE2s_256/BLAKE2b_256/BLAKE2b_384/BLAKE2b_512 Args[1] string: value

func ProcessHmac added in v0.10.1

func ProcessHmac(process *gou.Process) interface{}

ProcessHmac yao.crypto.hmac Crypto the Keyed-Hash Message Authentication Code (HMAC) Hash Args[0] string: the hash function name. MD4/MD5/SHA1/SHA224/SHA256/SHA384/SHA512/MD5SHA1/RIPEMD160/SHA3_224/SHA3_256/SHA3_384/SHA3_512/SHA512_224/SHA512_256/BLAKE2s_256/BLAKE2b_256/BLAKE2b_384/BLAKE2b_512 Args[1] string: value Args[2] string: key Args[3] string: base64

func WeworkDecrypt

func WeworkDecrypt(encodingAESKey string, msgEncrypt string, parse bool) (map[string]interface{}, error)

WeworkDecrypt wework msg Decrypt

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder instance

func NewDecoder

func NewDecoder(reader io.Reader) *Decoder

NewDecoder create new decoder instance

func NewDecoderWithPrefix

func NewDecoderWithPrefix(reader io.Reader, attrPrefix, textPrefix string) *Decoder

NewDecoderWithPrefix create new decoder instance with custom attribute prefix and text prefix

func (*Decoder) Decode

func (d *Decoder) Decode() (map[string]interface{}, error)

Decode xml string to map[string]interface{}

Jump to

Keyboard shortcuts

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