java.lang.Object
net.i2p.crypto.eddsa.math.Curve
All Implemented Interfaces:
Serializable

public class Curveextends Object implements Serializable
A twisted Edwards curve. Points on the curve satisfy $-x^2 + y^2 = 1 + d x^2y^2$.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Pinned for serialized-form compatibility.
      See Also:
    • f

      private final Field f
      The finite field.
    • d

      private final FieldElement d
      The curve parameter d.
    • d2

      private final FieldElement d2
      Twice the curve parameter d.
    • I

      private final FieldElement I
      The square root of -1.
    • zeroP2

      private final GroupElement zeroP2
      Zero p2.
    • zeroP3

      private final GroupElement zeroP3
      Zero p3.
    • zeroP3PrecomputedDouble

      private final GroupElement zeroP3PrecomputedDouble
      Zero p3 precomputed double.
    • zeroPrecomp

      private final GroupElement zeroPrecomp
      Zero precomp.
  • Constructor Details

    • Curve

      public Curve(Field f, byte[] d, FieldElement i)
      Create a twisted Edwards curve.
      Parameters:
      f - the finite field
      d - the curve parameter d
      i - the square root of -1
  • Method Details

    • getField

      public Field getField()
      Return the field this curve is defined over.
      Returns:
      the prime field, which carries q as its modulus
    • getD

      public FieldElement getD()
      Return the curve parameter d.
      Returns:
      the curve parameter d
    • get2D

      public FieldElement get2D()
      Return twice the curve parameter d.
      Returns:
      2 * d
    • getI

      public FieldElement getI()
      Return the square root of -1.
      Returns:
      the square root of -1
    • getZero

      Return the zero element for the given representation.
      Parameters:
      repr - the representation type
      Returns:
      the zero element, or null if unsupported
    • createPoint

      public GroupElement createPoint(byte[] p, boolean precompute)
      Create a point from an encoded representation.
      Parameters:
      p - the encoded point
      precompute - whether to precompute
      Returns:
      the group element
    • hashCode

      public int hashCode()
      The hash code of this curve.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code.
    • equals

      public boolean equals(Object o)
      Whether this curve equals the given object.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare.
      Returns:
      True if equal.