bigint

package
v0.97.3-pre Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 4 Imported by: 7

Documentation

Overview

Package bigint implements Neo-specific big.Int (de)serialization to/from []byte.

Index

Constants

View Source
const (
	// MaxBytesLen is the maximum length of serialized integer suitable for Neo VM.
	MaxBytesLen = 33 // 32 bytes for 256-bit integer plus 1 if padding needed

)

Variables

This section is empty.

Functions

func FromBytes

func FromBytes(data []byte) *big.Int

FromBytes converts data in little-endian format to an integer.

func FromBytesUnsigned added in v0.96.0

func FromBytesUnsigned(data []byte) *big.Int

FromBytesUnsigned converts data in little-endian format to an unsigned integer.

func ToBytes

func ToBytes(n *big.Int) []byte

ToBytes converts integer to a slice in little-endian format. Note: NEO3 serialization differs from default C# BigInteger.ToByteArray()

when n == 0. For zero is equal to empty slice in NEO3.

https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/Types/Integer.cs#L16

func ToPreallocatedBytes

func ToPreallocatedBytes(n *big.Int, data []byte) []byte

ToPreallocatedBytes converts integer to a slice in little-endian format using given byte array for conversion result.

Types

This section is empty.

Jump to

Keyboard shortcuts

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