2using System.Security.Cryptography;
12 private readonly BigInteger p34;
41 this.p34 = (this.p - 3) / 4;
47 protected abstract BigInteger
D
59 return new PointOnCurve(BigInteger.Zero, BigInteger.One);
83 BigInteger G = this.
modP.
Add(B, E);
100 BigInteger A = this.
modP.
Add(P.X, P.Y);
120 public override BigInteger
GetX(BigInteger Y,
bool X0)
123 BigInteger u = y2 - BigInteger.One;
127 BigInteger v = this.
modP.
Multiply(this.
D, y2) - BigInteger.One;
134 BigInteger.ModPow(
this.modP.Multiply(u5, v3),
this.p34,
this.p));
142 throw new ArgumentException(
"Not a valid point.", nameof(Y));
147 throw new ArgumentException(
"Not a valid point.", nameof(Y));
Base class of different types of Edwards curves over a prime field.
BigInteger d
Edwards curve coefficient
Base class of Edwards curves (x²+y²=1+dx²y²) over a prime field.
override void Double(ref PointOnCurve P)
Doubles a point on the curve.
EdwardsCurve(BigInteger Prime, PointOnCurve BasePoint, BigInteger d, BigInteger Order, int Cofactor)
Base class of Edwards curves (x²+y²=1+dx²y²) over a prime field.
override PointOnCurve Zero
Neutral point.
abstract BigInteger D
d coefficient of Edwards curve.
override BigInteger GetX(BigInteger Y, bool X0)
Gets the X-coordinate that corresponds to a given Y-coordainte, and the first bit of the X-coordinate...
EdwardsCurve(BigInteger Prime, PointOnCurve BasePoint, BigInteger d, BigInteger Order, int Cofactor, byte[] Secret)
Base class of Edwards curves (x²+y²=1+dx²y²) over a prime field.
override void AddTo(ref PointOnCurve P, PointOnCurve Q)
Adds Q to P .
BigInteger Order
Order of curve.
int Cofactor
Cofactor of curve.
PointOnCurve BasePoint
Base-point of curve.
BigInteger Multiply(BigInteger a, BigInteger b)
Multiplies two numbers, modulus p
BigInteger Add(BigInteger a, BigInteger b)
Adds two numbers, modulus p
BigInteger Subtract(BigInteger a, BigInteger b)
Subtracts two numbers, modulus p
readonly ModulusP modP
Arithmetic modulus p
BigInteger Prime
Prime of curve.
readonly BigInteger p
Prime p
Represents a point on a curve.
bool IsHomogeneous
If the point is in homogeneous coordinates.