utils

package
v0.0.0-...-11cfeae Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EllipticMarshal

func EllipticMarshal(curve elliptic.Curve, x, y *big.Int) ([]byte, error)

EllipticMarshal is revised from elliptic.Marshal to correct the negative bigint problem

func EllipticUnmarshal

func EllipticUnmarshal(curve elliptic.Curve, data []byte) (x, y *big.Int, err error)

EllipticUnmarshal is revised from elliptic.Unmarshal to correct the negative bigint problem

func MarshalBigInt

func MarshalBigInt(num *big.Int) ([]byte, error)

MarshalBigInt correctly encode a negative bigint, if the bigint is negative, don't use big.Int.Bytes() to encode the bigint

func UnmarshalBigInt

func UnmarshalBigInt(bytes []byte) (*big.Int, error)

UnmarshalBigInt correctly decode a bigint, even a negative bigint

Types

This section is empty.

Jump to

Keyboard shortcuts

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