24 protected readonly BigInteger
p;
51 if (
Prime <= BigInteger.One)
52 throw new ArgumentException(
"Invalid prime base.", nameof(
Prime));
107 int i, c = BigEndianDWords.Length;
109 byte[] B =
new byte[((BigEndianDWords[0] & 0x80000000) != 0) ? j + 1 : j];
112 for (i = 0; i < c; i++)
114 k = BigEndianDWords[i];
139 PointOnCurve Result = base.ScalarMultiplication(N, P, Normalize);
167 while (D.IsZero || D >=
this.n);
Abstract base class for elliptic curves.
BigInteger Order
Order of curve.
int Cofactor
Cofactor of curve.
static BigInteger ToInt(byte[] Binary, bool BigEndian)
Converts a little-endian binary representation of a big integer to a BigInteger.
readonly int bigIntegerBytes
Number of bytes used for big integers in the curve.
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.
static BigInteger ToBigInteger(uint[] BigEndianDWords)
Converts a sequence of unsigned 32-bit integers to a BigInteger.
readonly ModulusP modN
Arithmetic modulus n
override PointOnCurve ScalarMultiplication(byte[] N, PointOnCurve P, bool Normalize)
Performs the scalar multiplication of N *P .
virtual HashFunctionStream HashFunctionStream
Hash function to use in signatures for data streams.
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)
static byte[] ToByteSecret(uint[] BigEndianDWords)
Converts a sequence of unsigned 32-bit integers to a secret that can be used with BigInteger
ModulusP ModulusN
Arithmetic modulus n (the order)
PrimeFieldCurve(BigInteger Prime, PointOnCurve BasePoint, BigInteger Order, int Cofactor, uint[] Secret)
Base class of Elliptic curves over a prime field.
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.
Contains methods for simple hash calculations.
static byte[] ComputeSHA256Hash(byte[] Data)
Computes the SHA-256 hash of a block of binary data.
delegate byte[] HashFunctionArray(byte[] Data)
Delegate to hash function.
HashFunction
Hash method enumeration.
Represents a point on a curve.
void Normalize(PrimeFieldCurve Curve)
Normalizes a point, if in homogeneous coorinates.