// Create a new Scalar for the Ed25519 curve. func (c *Curve) Scalar() abstract.Scalar { // if c.FullGroup { // return nist.NewInt(0, fullOrder) // } else { i := nist.NewInt64(0, &primeOrder.V) i.BO = nist.LittleEndian return i // } }
// Create a new Scalar for this curve. func (c *curve) Scalar() abstract.Scalar { return nist.NewInt64(0, &c.order.V) }
"crypto/sha256" "encoding/hex" "math/big" "github.com/dedis/crypto/abstract" "github.com/dedis/crypto/group" "github.com/dedis/crypto/nist" "github.com/dedis/crypto/random" "github.com/dedis/crypto/sha3" ) // prime order of base point = 2^252 + 27742317777372353535851937790883648493 var primeOrder, _ = new(nist.Int).SetString("7237005577332262213973186563042994240857116359379907606001950938285454250989", "", 10) // curve's cofactor var cofactor = nist.NewInt64(8, &primeOrder.V) var nullPoint = new(point).Null() type point struct { p C.ge_p3 } type curve struct { } // Convert little-endian byte slice to hex string func tohex(s []byte) string { b := make([]byte, len(s)) for i := range b { // byte-swap to big-endian for display b[i] = s[31-i]
// Create a new ModInt representing a coordinate on this curve, // with a given int64 integer value for constant-initialization convenience. func (P *basicPoint) coord(v int64) *nist.Int { return nist.NewInt64(v, &P.c.P) }