Documentation ¶
Overview ¶
Package eccgroup implements prime-order group supported elliptic curves with hash-to-curve operations.
Supported Curves;
- Ristretto255
- P256
- P384
- P521
Index ¶
- type Element
- func (e *Element) Add(element *Element) *Element
- func (e *Element) Base() *Element
- func (e *Element) Copy() *Element
- func (e *Element) Decode(data []byte) error
- func (e *Element) Double() *Element
- func (e *Element) Encode() []byte
- func (e *Element) Equal(element *Element) int
- func (e *Element) Identity() *Element
- func (e *Element) IsIdentity() bool
- func (e *Element) MarshalBinary() ([]byte, error)
- func (e *Element) MarshalText() (text []byte, err error)
- func (e *Element) Multiply(scalar *Scalar) *Element
- func (e *Element) Negate() *Element
- func (e *Element) Set(element *Element) *Element
- func (e *Element) Subtract(element *Element) *Element
- func (e *Element) UnmarshalBinary(data []byte) error
- func (e *Element) UnmarshalText(text []byte) error
- type Group
- func (g Group) Available() bool
- func (g Group) Base() *Element
- func (g Group) ElementLength() uint
- func (g Group) EncodeToGroup(input, dst []byte) *Element
- func (g Group) HashToGroup(input, dst []byte) *Element
- func (g Group) HashToScalar(input, dst []byte) *Scalar
- func (g Group) NewElement() *Element
- func (g Group) NewScalar() *Scalar
- func (g Group) RandomElement() *Element
- func (g Group) RandomScalar() *Scalar
- func (g Group) ScalarLength() uint
- func (g Group) String() string
- type Scalar
- func (s *Scalar) Add(scalar *Scalar) *Scalar
- func (s *Scalar) Copy() *Scalar
- func (s *Scalar) Decode(in []byte) error
- func (s *Scalar) Encode() []byte
- func (s *Scalar) Equal(scalar *Scalar) int
- func (s *Scalar) Invert() *Scalar
- func (s *Scalar) IsZero() bool
- func (s *Scalar) MarshalBinary() ([]byte, error)
- func (s *Scalar) MarshalText() (text []byte, err error)
- func (s *Scalar) Multiply(scalar *Scalar) *Scalar
- func (s *Scalar) One() *Scalar
- func (s *Scalar) Random() *Scalar
- func (s *Scalar) Set(scalar *Scalar) *Scalar
- func (s *Scalar) Subtract(scalar *Scalar) *Scalar
- func (s *Scalar) UnmarshalBinary(data []byte) error
- func (s *Scalar) UnmarshalText(text []byte) error
- func (s *Scalar) Zero() *Scalar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
Element represents an element on the curve of the prime-order group.
func (*Element) Add ¶
Add sets the receiver to the sum of the input and the receiver, and returns the receiver.
func (*Element) Base ¶
Base sets the receiver to the group's base point a.k.a. canonical generator, and returns the receiver.
func (*Element) Decode ¶
Decode sets the receiver to a decoding of the input data, and returns an error on failure.
func (*Element) Equal ¶
Equal returns 1 if the receiver and input element are equivalent, and 0 otherwise.
func (*Element) Identity ¶
Identity sets the receiver to the point at infinity of the Group's underlying curve, and returns the reveiver.
func (*Element) IsIdentity ¶
IsIdentity returns whether the receiver is the point at infinity of the Group's underlying curve.
func (*Element) MarshalBinary ¶
MarshalBinary returns the compressed byte encoding of the element.
func (*Element) MarshalText ¶
MarshalText implements the encoding.MarshalText interface.
func (*Element) Multiply ¶
Multiply sets the receiver to the scalar multiplication of the receiver with the given Scalar, and returns it.
func (*Element) Subtract ¶
Subtract subtracts the input from the receiver, and returns the receiver.
func (*Element) UnmarshalBinary ¶
UnmarshalBinary sets e to the decoding of the byte encoded element.
func (*Element) UnmarshalText ¶
UnmarshalText implements the encoding.UnmarshalText interface.
type Group ¶
type Group byte
Group identifies prime-order groups over elliptic curves with hash-to-curve operations
const ( // Ristretto255Sha512 identifies the Ristretto255 group with SHA2-512 hash-to-group hashing Ristretto255Sha512 Group = 1 + iota // P256Sha256 identifies a group over P256 with SHA2-512 hash-to-group hashing P256Sha256 // P384Sha384 identifies a group over P384 with SHA2-384 hash-to-group hashing P384Sha384 // P521Sha512 identifies a group over P521 with SHA2-512 hash-to-group hashing P521Sha512 )
func (Group) ElementLength ¶
ElementLength returns the byte size of an encoded element.
func (Group) EncodeToGroup ¶
EncodeToGroup returns a non-uniform mapping of the arbitrary input to an Element in the Group. The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
func (Group) HashToGroup ¶
HashToGroup returns a safe mapping of the arbitrary input to an Element in the Group. The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
func (Group) HashToScalar ¶
HashToScalar returns a safe mapping of the arbitrary input to a Scalar. The DST must not be empty or nil, and is recommended to be longer than 16 bytes.
func (Group) NewElement ¶
NewElement returns the identity element (point at infinity).
func (Group) RandomElement ¶
RandomElement returns randomly generated element.
func (Group) RandomScalar ¶
RandomScalar returns randomly generated scalar.
func (Group) ScalarLength ¶
ScalarLength returns the byte size of an encoded scalar.
type Scalar ¶
Scalar represents a scalar in the prime-order group.
func (*Scalar) Add ¶
Add sets the receiver to the sum of the input and the receiver, and returns the receiver.
func (*Scalar) Decode ¶
Decode sets the receiver to a decoding of the input data, and returns an error on failure.
func (*Scalar) Invert ¶
Invert sets the receiver to the scalar's modular inverse ( 1 / scalar ), and returns it.
func (*Scalar) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (*Scalar) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Scalar) Multiply ¶
Multiply multiplies the receiver with the input, and returns the receiver.
func (*Scalar) Random ¶
Random sets the current scalar to a new random scalar and returns it. The random source is crypto/rand, and this functions is guaranteed to return a non-zero scalar.
func (*Scalar) Set ¶
Set sets the receiver to the value of the argument scalar, and returns the receiver.
func (*Scalar) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*Scalar) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
Directories ¶
Path | Synopsis |
---|---|
Package internal wraps all nist and ristretto255 curves into interfaces
|
Package internal wraps all nist and ristretto255 curves into interfaces |
nist
Package nist implements nist's curves prime-order group
|
Package nist implements nist's curves prime-order group |
r255
Package r255 implements Ristretto255 curve prime-order groups with backend "filippo.io/edwards25519"
|
Package r255 implements Ristretto255 curve prime-order groups with backend "filippo.io/edwards25519" |