byteconversion

package
v0.0.0-...-e97b738 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: LGPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToBigInt

func ConvertToBigInt(in []byte) (*big.Int, error)

Decodes a byte array (ASCII encoding of a signed integer) into a big integer

func FlipBytes

func FlipBytes(bytesIn []byte) []byte

*

  • Flips all bytes in each of the array's elements.
  • Returns the flipped elements.

func FromByteArray

func FromByteArray(bytesIn []byte) (*big.Int, error)

*

  • Returns the big.Int based on the passed byte-array assuming the byte-array contains
  • the two's-complement representation of this big.Int. The byte array will be in big-endian byte-order:
  • the most significant byte is in the zeroth element. The array will contain the minimum number of bytes
  • required to represent this BigInteger, including at least one sign bit, which is (ceil((this.bitLength() + 1)/8)).

func ParseInput

func ParseInput(in []byte) ([]*big.Int, error)

Decodes a byte array (ASCII encoding of comma-separated integers) into an array of big integers

func ToByteArray

func ToByteArray(in *big.Int) []byte

*

  • Returns a byte array containing the two's-complement representation of this big.Int.
  • The byte array will be in big-endian byte-order: the most significant byte is in the
  • zeroth element. The array will contain the minimum number of bytes required to represent
  • this BigInteger, including at least one sign bit, which is (ceil((this.bitLength() + 1)/8)).

Types

This section is empty.

Jump to

Keyboard shortcuts

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