Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var A *big.Int
A is one of the babyjub constants.
var Aff *ff.Element
Aff is A value in *ff.Element representation
var C *big.Int
Cofactor.
var D *big.Int
D is one of the babyjub constants.
var Dff *ff.Element
Dff is D value in *ff.Element representation
var L *big.Int
L*B = 0, and (2^C)*L == #E
var Order *big.Int
Order of the babyjub curve.
var SubOrder *big.Int
SubOrder is the order of the subgroup of the babyjub curve that contains the points that we use.
Functions ¶
func PackSignY ¶
PackSignY packs the given sign and the coordinate Y of a point into a 32 byte array. This method does not check that the values belong to a valid Point in the curve.
func PointCoordSign ¶
PointCoordSign returns the sign of the curve point coordinate. It returns false if the sign is positive and false if the sign is negative.
func SkToBigInt ¶
func SkToBigInt(k *PrivateKey) *big.Int
SkToBigInt converts a private key into the *big.Int value following the EdDSA standard, and using blake-512 hash
func UnpackSignY ¶
UnpackSignY returns the sign and coordinate Y from a given compressed point. This method does not check that the Point belongs to the BabyJubJub curve, thus does not return error in such case. This method is intended to obtain the sign and the Y coordinate without checking if the point belongs to the curve, if the objective is to uncompress a point, Decompress method should be used instead.
Types ¶
type Point ¶
Point represents a point of the babyjub curve.
var B8 *Point
B8 is a base point of the babyjub multiplied by 8 to make it a base point of the subgroup in the curve.
func PointFromSignAndY ¶
PointFromSignAndY returns a Point from a Sign and the Y coordinate
func (*Point) Compress ¶
Compress the point into a 32 byte array that contains the y coordinate in little endian and the sign of the x coordinate.
func (*Point) Decompress ¶
Decompress a compressed Point into p, and also returns the decompressed Point. Returns error if the compressed Point is invalid.
func (*Point) Mul ¶
Mul multiplies the Point q by the scalar s and stores the result in p, which is also returned.
func (*Point) Projective ¶
func (p *Point) Projective() *PointProjective
Projective returns a PointProjective from the Point
type PointProjective ¶
PointProjective is the Point representation in projective coordinates
func NewPointProjective ¶
func NewPointProjective() *PointProjective
NewPointProjective creates a new Point in projective coordinates.
func (*PointProjective) Add ¶
func (p *PointProjective) Add(q *PointProjective, o *PointProjective) *PointProjective
Add computes the addition of two points in projective coordinates representation
func (*PointProjective) Affine ¶
func (p *PointProjective) Affine() *Point
Affine returns the Point from the projective representation
type PrivKeyScalar ¶
PrivKeyScalar represents the scalar s output of a private key
func NewPrivKeyScalar ¶
func NewPrivKeyScalar(s *big.Int) *PrivKeyScalar
NewPrivKeyScalar creates a new PrivKeyScalar from a big.Int
func (*PrivKeyScalar) BigInt ¶
func (s *PrivKeyScalar) BigInt() *big.Int
BigInt returns the big.Int corresponding to a PrivKeyScalar.
func (*PrivKeyScalar) Public ¶
func (s *PrivKeyScalar) Public() *PublicKey
Public returns the public key corresponding to the scalar value s of a private key.
type PrivateKey ¶
type PrivateKey [32]byte
PrivateKey is an EdDSA private key, which is a 32byte buffer.
func (*PrivateKey) Public ¶
func (k *PrivateKey) Public() *PublicKey
Public returns the public key corresponding to a private key.
func (*PrivateKey) Scalar ¶
func (k *PrivateKey) Scalar() *PrivKeyScalar
Scalar converts a private key into the scalar value s following the EdDSA standard, and using blake-512 hash.
func (*PrivateKey) SignPoseidon ¶
func (k *PrivateKey) SignPoseidon(msg *big.Int) *Signature
SignPoseidon signs a message encoded as a big.Int in Zq using blake-512 hash for buffer hashing and Poseidon for big.Int hashing.
type PublicKey ¶
type PublicKey Point
PublicKey represents an EdDSA public key, which is a curve point.
type Signature ¶
Signature represents an EdDSA uncompressed signature.
func (*Signature) Compress ¶
func (s *Signature) Compress() SignatureComp
Compress an EdDSA signature by concatenating the compression of the point R8 and the Little-Endian encoding of S.
type SignatureComp ¶
type SignatureComp [64]byte
SignatureComp represents a compressed EdDSA signature.