Documentation ¶
Overview ¶
Package utils provides auxiliary functions required by the Coconut Scheme.
Index ¶
- func GenerateLagrangianCoefficients(n int, p *Curve.BIG, xs []*Curve.BIG, x int) []*Curve.BIG
- func GenerateRandomBIGSlice(p *Curve.BIG, rng *amcl.RAND, n int) []*Curve.BIG
- func HashBytes(sha int, b []byte) ([]byte, error)
- func HashBytesToBig(sha int, b []byte) (*Curve.BIG, error)
- func HashBytesToG1(sha int, b []byte) (*Curve.ECP, error)
- func HashStringToBig(sha int, m string) (*Curve.BIG, error)
- func HashStringToG1(sha int, m string) (*Curve.ECP, error)
- func LagrangeBasis(i int, o *Curve.BIG, xs []*Curve.BIG, x int) *Curve.BIG
- func PolyEval(coeff []*Curve.BIG, x *Curve.BIG, o *Curve.BIG) *Curve.BIG
- func ToCoconutString(p Printable) string
- type Printable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateLagrangianCoefficients ¶
GenerateLagrangianCoefficients creates a slice of Lagragian Coefficients
func GenerateRandomBIGSlice ¶
GenerateRandomBIGSlice creates a slice of specified length with random BIGs.
func HashBytes ¶
HashBytes takes a bytes message and returns its SHA256/SHA384/SHA512 hash It is based on the amcl implementation: https://github.com/milagro-crypto/amcl/blob/master/version3/go/MPIN.go#L83
func HashBytesToBig ¶
HashBytesToBig takes a bytes message and maps it to a BIG number It is based on the amcl implementation: https://github.com/milagro-crypto/amcl/blob/master/version3/go/MPIN.go#L707
func HashBytesToG1 ¶
HashBytesToG1 takes a bytes message and maps it to a point on G1 Curve Python implementation use SHA512, so temporarily hardcoding it here
func HashStringToBig ¶
HashStringToBig takes a string message and maps it to a BIG number
func HashStringToG1 ¶
HashStringToG1 takes a string message and maps it to a point on G1 Curve
func LagrangeBasis ¶
LagrangeBasis generates the lagrange basis polynomial li(x), for a polynomial of degree t-1. Takes x values from xs and calculates the basis for point xs[i]. It is done around at x (usually 0). It's based on the original Python implementation: https://github.com/asonnino/coconut/blob/master/coconut/utils.py#L37.
func PolyEval ¶
PolyEval evaluates a polynomial defined by the slice of coefficient coeff at point x. All operations are performed mod o. It's based on the original Python implementation: https://github.com/asonnino/coconut/blob/master/coconut/utils.py#L33.
func ToCoconutString ¶
ToCoconutString returns string representation of ECP or ECP2 object such that it is compatible with representation of Python implementation.
Types ¶
type Printable ¶
type Printable interface {
ToString() string
}
Printable is a wrapper for all objects that have ToString method. In particular Curve.ECP and Curve.ECP2.
func CombinePrintables ¶
CombinePrintables combines multiple slices of Printable into a single slice.
func ECP2SliceToPrintable ¶
ECP2SliceToPrintable converts slice of ECP2 to slice of Printable.
func ECPSliceToPrintable ¶
ECPSliceToPrintable converts slice of ECP to slice of Printable.