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 Buffer.BlockCopy(Secret, 0,
PrivateKey, 0, Math.Min(32, Secret.Length));
97 public override byte[]
Sign(
byte[] Data,
bool BigEndian)
108 public override byte[]
Sign(Stream Data,
bool BigEndian)
121 public override bool Verify(
byte[] Data,
byte[]
PublicKey,
bool BigEndian,
byte[] Signature)
134 public override bool Verify(Stream Data,
byte[]
PublicKey,
bool BigEndian,
byte[] Signature)
Implements the Edwards curve Digital Signature Algorithm (EdDSA), as defined in RFC 8032....
static bool Verify(byte[] Data, byte[] PublicKey, bool BigEndian, HashFunctionArray HashFunction, EdwardsCurveBase Curve, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
static byte[] Sign(byte[] Data, bool BigEndian, byte[] PrivateKey, byte[] Prefix, HashFunctionArray HashFunction, EdwardsCurveBase Curve)
Signs data using the EdDSA algorithm.
Edwards25519 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf....
override byte[] Sign(Stream Data, bool BigEndian)
Creates a signature of Data using the EdDSA algorithm.
Edwards25519(byte[] Secret)
Edwards25519 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf....
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 bool Verify(byte[] Data, byte[] PublicKey, bool BigEndian, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
override Tuple< byte[], byte[]> CalculatePrivateKey(byte[] Secret)
Calculates a private key from a secret.
override string CurveName
Name of curve.
override byte[] Sign(byte[] Data, bool BigEndian)
Creates a signature of Data using the EdDSA algorithm.
override int CoordinateBits
Number of bits used to encode the y-coordinate.
override bool Verify(Stream Data, byte[] PublicKey, bool BigEndian, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
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.