2using System.Globalization;
15 private static readonly BigInteger p0 = BigInteger.Pow(2, 255) - 19;
16 private static readonly BigInteger d0 = BigInteger.Parse(
"37095705934669439343138083508754565189542113879843219016388785533085940283555");
17 private static readonly BigInteger n0 = BigInteger.Pow(2, 252) + BigInteger.Parse(
"14def9dea2f79cd65812631a5cf5d3ed", NumberStyles.HexNumber);
18 private static readonly BigInteger BasePointX = BigInteger.Parse(
"15112221349535400772501151409588531511454012693041857206046113283949847762202");
19 private static readonly BigInteger BasePointY = BigInteger.Parse(
"46316835694926478169428394003475163141307993866256225615783033603165251855960");
20 private readonly
bool hashSecret;
51 : base(p0, new
PointOnCurve(BasePointX, BasePointY), d0, n0, 8, Secret)
53 this.hashSecret = HashSecret;
80 Array.Copy(Secret, 0,
PrivateKey, 0, Math.Min(32, Secret.Length));
96 public override byte[]
Sign(
byte[] Data)
106 public override byte[]
Sign(Stream Data)
Implements the Edwards curve Digital Signature Algorithm (EdDSA), as defined in RFC 8032....
static byte[] Sign(byte[] Data, byte[] PrivateKey, byte[] Prefix, HashFunctionArray HashFunction, EdwardsCurveBase Curve)
Signs data using the EdDSA algorithm.
static bool Verify(byte[] Data, byte[] PublicKey, HashFunctionArray HashFunction, EdwardsCurveBase Curve, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
Edwards25519 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf....
override bool Verify(byte[] Data, byte[] PublicKey, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
Edwards25519(byte[] Secret)
Edwards25519 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf....
override bool Verify(Stream Data, byte[] PublicKey, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
override byte[] Sign(Stream Data)
Creates a signature of Data using the EdDSA algorithm.
override byte[] Sign(byte[] Data)
Creates a signature of Data using the EdDSA algorithm.
Edwards25519(byte[] Secret, bool HashSecret)
Edwards25519 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf....
Edwards25519()
Edwards25519 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf....
override Tuple< byte[], byte[]> CalculatePrivateKey(byte[] Secret)
Calculates a private key from a secret.
override string CurveName
Name of curve.
override int CoordinateBits
Number of bits used to encode the y-coordinate.
Base class of Twisted Edwards curves (-x²+y²=1+dx²y²) over a prime field.
byte[] AdditionalInfo
Curve-specific additional information
virtual byte[] PublicKey
Encoded public key
byte[] PrivateKey
Private key
Contains methods for simple hash calculations.
static byte[] ComputeSHA512Hash(byte[] Data)
Computes the SHA-512 hash of a block of binary data.
Represents a point on a curve.