ec: define on use
This commit is contained in:
parent
dc3d9aec65
commit
42e7197c46
1 changed files with 4 additions and 2 deletions
|
@ -95,11 +95,13 @@ function pointFpEquals(other) {
|
||||||
if (other.isInfinity()) return this.isInfinity()
|
if (other.isInfinity()) return this.isInfinity()
|
||||||
|
|
||||||
// u = Y2 * Z1 - Y1 * Z2
|
// 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
|
if (u.signum() !== 0) return false
|
||||||
|
|
||||||
// v = X2 * Z1 - X1 * Z2
|
// 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
|
return v.signum() === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue