Browse Source

ec: define on use

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
42e7197c46
  1. 6
      src/ec.js

6
src/ec.js

@ -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
}

Loading…
Cancel
Save