u8compact

package
v0.0.0-...-f5f0bdb Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBitLength = 32

DefaultBitLength ...

Variables

View Source
var MaxU16 = new(big.Int).Sub(mathutil.Pow(big.NewInt(2), big.NewInt(16-2)), big.NewInt(1))

MaxU16 ...

View Source
var MaxU32 = new(big.Int).Sub(mathutil.Pow(big.NewInt(2), big.NewInt(32-2)), big.NewInt(1))

MaxU32 ...

View Source
var MaxU8 = new(big.Int).Sub(mathutil.Pow(big.NewInt(2), big.NewInt(8-2)), big.NewInt(1))

MaxU8 ...

Functions

func AddLength

func AddLength(input []uint8, bitLength int) []uint8

AddLength adds a length prefix to the input value.

func CompactToUint8Slice

func CompactToUint8Slice(value *big.Int, bitLength int) []uint8

CompactToUint8Slice encodes a number into a compact representation.

func FromUint8Slice

func FromUint8Slice(input []uint8, bitLength int) (int, *big.Int)

FromUint8Slice retrieves the offset and encoded length from a compact-prefixed value

func StripLength

func StripLength(input []uint8, bitLength int) (int, []uint8)

StripLength removes the length prefix, returning both the total length (including the value + compact encoding) and the decoded value with the correct length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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