u8util

package
v0.0.0-...-3f3ae68 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidHex = errors.New("Invalid hex string")

ErrInvalidHex ...

Functions

func Concat

func Concat(slices ...[]uint8) []uint8

Concat concatenates multiple uint8 slices into a new slice

func FixLength

func FixLength(value []uint8, bitLength int, atStart bool) []uint8

FixLength shifts a uint8 slice to a specific bitLength. Returns a uint8 slice with the specified number of bits contained in the return value. (If bitLength is -1, length checking is not done). Values with more bits are trimmed to the specified length.

func FromHex

func FromHex(hexStr string) []uint8

FromHex creates a uint8 slice from a hex string

func IsU8a

func IsU8a(value interface{}) bool

IsU8a ... TODO: need to implement from https://github.com/polkadot-js/common/tree/master/packages/util

func ToBN

func ToBN(value []uint8, isLittleEndian bool) *big.Int

ToBN creates a utf-8 string from a uint8 slice.

func ToHex

func ToHex(value []uint8, bitLength int, isPrefixed bool) string

ToHex creates a hex string from a uint8 slice. Set bitLength to -1 for default

func ToString

func ToString(value []uint8) string

ToString creates a utf-8 string from a uint8 slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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