2using System.Collections.Generic;
4using System.Security.Cryptography;
28 protected readonly BigInteger
p;
55 if (
Prime <= BigInteger.One)
56 throw new ArgumentException(
"Invalid prime base.", nameof(
Prime));
77 PointOnCurve Result = base.ScalarMultiplication(N, P, Normalize);
105 while (D.IsZero || D >=
this.n);
Abstract base class for elliptic curves.
BigInteger Order
Order of curve.
readonly int orderBytes
Number of bytes used for the order of the curve.
int Cofactor
Cofactor of curve.
static BigInteger ToInt(byte[] Binary)
Converts a little-endian binary representation of a big integer to a BigInteger.
static readonly RandomNumberGenerator rnd
Random number generator
PointOnCurve BasePoint
Base-point of curve.
readonly byte msbOrderMask
Mask for most significant byte of scalars.
Integer arithmetic, modulus a prime.
Base class of Elliptic curves over a prime field.
readonly ModulusP modP
Arithmetic modulus p
BigInteger Prime
Prime of curve.
readonly ModulusP modN
Arithmetic modulus n
override PointOnCurve ScalarMultiplication(byte[] N, PointOnCurve P, bool Normalize)
Performs the scalar multiplication of N *P .
readonly BigInteger p
Prime p
PrimeFieldCurve(BigInteger Prime, PointOnCurve BasePoint, BigInteger Order, int Cofactor, byte[] Secret)
Base class of Elliptic curves over a prime field.
ModulusP ModulusP
Arithmetic modulus p (the prime)
ModulusP ModulusN
Arithmetic modulus n (the order)
override byte[] GenerateSecret()
Generates a new secret.
PrimeFieldCurve(BigInteger Prime, PointOnCurve BasePoint, BigInteger Order, int Cofactor)
Base class of Elliptic curves over a prime field.
Represents a point on a curve.
void Normalize(PrimeFieldCurve Curve)
Normalizes a point, if in homogeneous coorinates.