utils

package
v0.0.0-...-ea90456 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 密码错误,解密失败
	ErrPwWrong = errors.New("password is wrong")
)

Functions

func BytesCombine

func BytesCombine(pBytes ...[]byte) []byte

BytesCombine concatenates byte array

func BytesCompare

func BytesCompare(bytesA, bytesB []byte) bool

BytesCompare compares two byte arrays, give the result whether they are the same or not

func BytesPKCS5Padding

func BytesPKCS5Padding(cipherData []byte, blockSize int) []byte

PKCS7Padding:缺N个字节就补N个字节的0, PKCS5Padding:缺N个字节就补充N个字节的N,例如缺8个字节,就补充8个字节的数字8

func BytesPKCS5UnPadding

func BytesPKCS5UnPadding(originalData []byte) ([]byte, error)

PKCS7Padding:缺N个字节就补N个字节的0, PKCS5Padding:缺N个字节就补充N个字节的N,例如缺8个字节,就补充8个字节的数字8 PKCS5UnPadding:获取最后一个字节,转换为数字N,然后剔除掉最后N个字节,例如最后一个字节是数字8,就剔除掉最后8个字节

func BytesPad

func BytesPad(pBytes []byte, length int) []byte

把slice的长度补齐到指定字节的长度

func ChangePrivCurveToS256k1

func ChangePrivCurveToS256k1(key *ecdsa.PrivateKey) *ecdsa.PrivateKey

func StringInSlice

func StringInSlice(a string, list []string) bool

相当于php的in_array函数

Types

This section is empty.

Jump to

Keyboard shortcuts

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