ec: define on use

This commit is contained in:
Daniel Cousens 2014-06-04 16:06:30 +10:00
parent dc3d9aec65
commit 42e7197c46

View file

@ -95,11 +95,13 @@ function pointFpEquals(other) {
if (other.isInfinity()) return this.isInfinity()
// u = Y2 * Z1 - Y1 * Z2
u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q)
var u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q)
if (u.signum() !== 0) return false
// v = X2 * Z1 - X1 * Z2
v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q)
var v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q)
return v.signum() === 0
}