helper

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BHex2Num

func BHex2Num(str string, n int) int

36进制数转换 n 表示进制, 16 or 36

func BcdToString

func BcdToString(data []byte, ignorePadding ...bool) string

BCD转字符串

func Bytes2Str

func Bytes2Str(b []byte) string

func BytesSplit

func BytesSplit(data []byte, limit int) [][]byte

bytes切割

func BytesToString

func BytesToString(data []byte) string

bytes转字符串

func DecryptOAEP

func DecryptOAEP(hash hash.Hash, priv *rsa.PrivateKey, ciphertext []byte, label []byte) ([]byte, error)

使用RSA-OAEP解密

func EncryptOAEP

func EncryptOAEP(hash hash.Hash, pub *rsa.PublicKey, msg []byte, label []byte) ([]byte, error)

使用RSA-OAEP加密

func FromBCDTime

func FromBCDTime(bcd []byte) (time.Time, error)

转为time.Time

func GetBitByte

func GetBitByte(value byte, offset int) bool

func GetBitUint16

func GetBitUint16(value uint16, offset int) bool

func GetBitUint32

func GetBitUint32(value uint32, offset int) bool

func GetGeoPoint

func GetGeoPoint(lat uint32, south bool, lng uint32, west bool) (decimal.Decimal, decimal.Decimal)

获取经纬度

func NumToBHex

func NumToBHex(num, n int) string

func SetBitByte

func SetBitByte(value *byte, offset int, set bool)

func SetBitUint16

func SetBitUint16(value *uint16, offset int, set bool)

func SetBitUint32

func SetBitUint32(value *uint32, offset int, set bool)

func Str2Bytes

func Str2Bytes(s string) []byte

func StringToBCD

func StringToBCD(s string, size ...int) []byte

字符串转BCD

func ToBCDTime

func ToBCDTime(t time.Time) []byte

转为BCD时间

Types

type Reader

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

func NewReader

func NewReader(data []byte) Reader

func (*Reader) Len

func (reader *Reader) Len() int

func (*Reader) Read

func (reader *Reader) Read(size ...int) ([]byte, error)

func (*Reader) ReadBcdTime

func (reader *Reader) ReadBcdTime() (time.Time, error)

func (*Reader) ReadByte

func (reader *Reader) ReadByte() (byte, error)

func (*Reader) ReadString

func (reader *Reader) ReadString(size ...int) (string, error)

func (*Reader) ReadUint16

func (reader *Reader) ReadUint16() (uint16, error)

func (*Reader) ReadUint32

func (reader *Reader) ReadUint32() (uint32, error)

type Writer

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

func NewWriter

func NewWriter() Writer

func (*Writer) Bytes

func (writer *Writer) Bytes() []byte

func (*Writer) WritString

func (writer *Writer) WritString(str string, size ...int) error

func (*Writer) Write

func (writer *Writer) Write(p []byte, size ...int) *Writer

func (*Writer) WriteBcdTime

func (writer *Writer) WriteBcdTime(t time.Time) *Writer

func (*Writer) WriteByte

func (writer *Writer) WriteByte(b byte) *Writer

func (*Writer) WriteUint16

func (writer *Writer) WriteUint16(n uint16) *Writer

func (*Writer) WriteUint32

func (writer *Writer) WriteUint32(n uint32) *Writer

Jump to

Keyboard shortcuts

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