2using System.Globalization;
18 private static readonly BigInteger p0 = BigInteger.Pow(2, 448) - BigInteger.Pow(2, 224) - 1;
19 private static readonly BigInteger d0 = p0 - 39081;
20 private static readonly BigInteger n0 = BigInteger.Pow(2, 446) - BigInteger.Parse(
"008335dc163bb124b65129c96fde933d8d723a70aadc873d6d54a7bb0d", NumberStyles.HexNumber);
21 private static readonly BigInteger BasePointX = BigInteger.Parse(
"224580040295924300187604334099896036246789641632564134246125461686950415467406032909029192869357953282578032075146446173674602635247710");
22 private static readonly BigInteger BasePointY = BigInteger.Parse(
"298819210078481492676017930443930673437544040154080242095928241372331506189835876003536878655418784733982303233503462500531545062832660");
23 private readonly
SHAKE256 shake256_114;
24 private readonly
bool hashSecret;
55 : base(p0, new
PointOnCurve(BasePointX, BasePointY), d0, n0, 4, Secret)
57 this.shake256_114 =
new SHAKE256(114 << 3);
58 this.hashSecret = HashSecret;
78 byte[] Bin = this.shake256_114.ComputeVariable(Secret);
85 Buffer.BlockCopy(Secret, 0,
PrivateKey, 0, Math.Min(57, Secret.Length));
102 public override byte[]
Sign(
byte[] Data,
bool BigEndian)
114 public override byte[]
Sign(Stream Data,
bool BigEndian)
127 public override bool Verify(
byte[] Data,
byte[]
PublicKey,
bool BigEndian,
byte[] Signature)
140 public override bool Verify(Stream Data,
byte[]
PublicKey,
bool BigEndian,
byte[] Signature)
145 private byte[] H_dom4(
byte[] Data)
148 byte[] Bin =
new byte[10 + c];
150 Buffer.BlockCopy(preamble, 0, Bin, 0, 8);
153 Buffer.BlockCopy(Data, 0, Bin, 10, c);
155 return this.shake256_114.ComputeVariable(Bin);
158 private byte[] H_dom4(Stream Data)
162 TempFile.
Write(preamble, 0, 8);
167 Data.CopyTo(TempFile);
169 TempFile.Position = 0;
170 return this.shake256_114.ComputeVariable(TempFile);
174 private static readonly
byte[] preamble = Encoding.ASCII.GetBytes(
"SigEd448");
Manages a temporary stream. Contents is kept in-memory, if below a memory threshold,...
override void Write(byte[] buffer, int offset, int count)
When overridden in a derived class, writes a sequence of bytes to the current stream and advances the...
override void WriteByte(byte value)
Writes a byte to the current position in the stream and advances the position within the stream by on...
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.
Edwards448 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf.org/html/rfc7748 htt...
override Tuple< byte[], byte[]> CalculatePrivateKey(byte[] Secret)
Calculates a private key from a secret.
Edwards448(byte[] Secret)
Edwards448 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf.org/html/rfc7748 htt...
override bool Verify(byte[] Data, byte[] PublicKey, bool BigEndian, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
override byte[] Sign(byte[] Data, bool BigEndian)
Creates a signature of Data using the EdDSA algorithm.
Edwards448()
Edwards448 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf.org/html/rfc7748 htt...
Edwards448(byte[] Secret, bool HashSecret)
Edwards448 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf.org/html/rfc7748 htt...
override bool Verify(Stream Data, byte[] PublicKey, bool BigEndian, byte[] Signature)
Verifies a signature of Data made by the EdDSA algorithm.
override int CoordinateBits
Number of bits used to encode the y-coordinate.
override string CurveName
Name of curve.
override byte[] Sign(Stream Data, bool BigEndian)
Creates a signature of Data using the EdDSA algorithm.
Base class of 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
Implements the SHA3 SHAKE256 extendable-output functions, as defined in section 6....
Represents a point on a curve.