From e64a9d654cd730463c3ba0a24316d4d599581814 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Mon, 27 Feb 2023 15:07:45 +0000 Subject: [PATCH] Fix ristretto255 equals --- src/ed25519.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ed25519.ts b/src/ed25519.ts index 1240d6b..84a199f 100644 --- a/src/ed25519.ts +++ b/src/ed25519.ts @@ -312,7 +312,7 @@ export class RistrettoPoint { constructor(private readonly ep: ExtendedPoint) {} static fromAffine(ap: AffinePoint) { - return new RistrettoPoint(ed25519.ExtendedPoint.fromAffine(ap)) + return new RistrettoPoint(ed25519.ExtendedPoint.fromAffine(ap)); } /** @@ -407,7 +407,7 @@ export class RistrettoPoint { equals(other: RistrettoPoint): boolean { assertRstPoint(other); const { ex: X1, ey: Y1 } = this.ep; - const { ex: X2, ey: Y2 } = this.ep; + const { ex: X2, ey: Y2 } = other.ep; const mod = ed25519.CURVE.Fp.create; // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2) const one = mod(X1 * Y2) === mod(Y1 * X2); @@ -440,6 +440,6 @@ export const hash_to_ristretto255 = (msg: Uint8Array, options: htf.htfBasicOpts) const d = options.DST; const DST = typeof d === 'string' ? utf8ToBytes(d) : d; const uniform_bytes = htf.expand_message_xmd(msg, DST, 64, sha512); - const P = RistrettoPoint.hashToCurve(uniform_bytes) + const P = RistrettoPoint.hashToCurve(uniform_bytes); return P; };