Lines Matching refs:curve

38411   if (priv.curve) {
38442 var curveId = curves[priv.curve.join('.')];
38443 if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'));
38444 var curve = new EC(curveId);
38445 var key = curve.keyFromPrivate(priv.privateKey);
38621 var curveId = curves[pub.data.algorithm.curve.join('.')];
38622 if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'));
38623 var curve = new EC(curveId);
38625 return curve.verify(hash, sig, pubkey);
43592 module.exports = function createECDH(curve) {
43593 return new ECDH(curve);
43632 function ECDH(curve) {
43633 this.curveType = aliases[curve];
43637 name: curve
43641 this.curve = new elliptic.ec(this.curveType.name); // eslint-disable-line new-cap
43647 this.keys = this.curve.genKeyPair();
43658 var otherPub = this.curve.keyFromPublic(other).getPublic();
43703 this.keys = this.curve.genKeyPair();
45634 elliptic.curve = require('./elliptic/curve');
45884 function BasePoint(curve, type) {
45885 this.curve = curve;
45899 return this.curve.validate(this);
45922 var len = this.curve.p.byteLength();
46091 function Point(curve, x, y, z, t) {
46092 Base.BasePoint.call(this, curve, 'projective');
46095 this.x = this.curve.zero;
46096 this.y = this.curve.one;
46097 this.z = this.curve.one;
46098 this.t = this.curve.zero;
46103 this.z = z ? new BN(z, 16) : this.curve.one;
46105 if (!this.x.red) this.x = this.x.toRed(this.curve.red);
46106 if (!this.y.red) this.y = this.y.toRed(this.curve.red);
46107 if (!this.z.red) this.z = this.z.toRed(this.curve.red);
46108 if (this.t && !this.t.red) this.t = this.t.toRed(this.curve.red);
46109 this.zOne = this.z === this.curve.one; // Use extended coordinates
46111 if (this.curve.extended && !this.t) {
46128 Point.fromJSON = function fromJSON(curve, obj) {
46129 return new Point(curve, obj[0], obj[1], obj[2]);
46139 …return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) …
46154 var d = this.curve._mulA(a); // E = (X1 + Y1)^2 - A - B
46172 return this.curve.point(nx, ny, nz, nt);
46191 if (this.curve.twisted) {
46193 var e = this.curve._mulA(c); // F = E + D
46200 nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); // Y3 = F * (E - D)
46221 var h = this.curve._mulC(this.z).redSqr(); // J = E - 2 * H
46226 nx = this.curve._mulC(b.redISub(e)).redMul(j); // Y3 = c * E * (C - D)
46228 ny = this.curve._mulC(e).redMul(c.redISub(d)); // Z3 = E * J
46233 return this.curve.point(nx, ny, nz);
46239 if (this.curve.extended) return this._extDbl();else return this._projDbl();
46251 var c = this.t.redMul(this.curve.dd).redMul(p.t); // D = Z1 * 2 * Z2
46270 return this.curve.point(nx, ny, nz, nt);
46287 var e = this.curve.d.redMul(c).redMul(d); // F = B - E
46298 if (this.curve.twisted) {
46300 ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); // Z3 = F * G
46307 nz = this.curve._mulC(f).redMul(g);
46310 return this.curve.point(nx, ny, nz);
46316 if (this.curve.extended) return this._extAdd(p);else return this._projAdd(p);
46320 …if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k);else return this.curve._wnafMul(t…
46324 return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, false);
46328 return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, true);
46338 this.z = this.curve.one;
46344 return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());
46362 var rx = x.toRed(this.curve.red).redMul(this.z);
46365 var t = this.curve.redN.redMul(this.z);
46368 xc.iadd(this.curve.n);
46369 if (xc.cmp(this.curve.p) >= 0) return false;
46382 var curve = exports;
46383 curve.base = require('./base');
46384 curve.short = require('./short');
46385 curve.mont = require('./mont');
46386 curve.edwards = require('./edwards');
46419 function Point(curve, x, z) {
46420 Base.BasePoint.call(this, curve, 'projective');
46423 this.x = this.curve.one;
46424 this.z = this.curve.zero;
46428 if (!this.x.red) this.x = this.x.toRed(this.curve.red);
46429 if (!this.z.red) this.z = this.z.toRed(this.curve.red);
46451 return this.getX().toArray('be', this.curve.p.byteLength());
46454 Point.fromJSON = function fromJSON(curve, obj) {
46455 return new Point(curve, obj[0], obj[1] || curve.one);
46484 var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
46485 return this.curve.point(nx, nz);
46511 return this.curve.point(nx, nz);
46518 var b = this.curve.point(null, null); // (N / 2) * Q
46557 this.z = this.curve.one;
46819 function Point(curve, x, y, isRed) {
46820 Base.BasePoint.call(this, curve, 'affine');
46831 this.x.forceRed(this.curve.red);
46832 this.y.forceRed(this.curve.red);
46835 if (!this.x.red) this.x = this.x.toRed(this.curve.red);
46836 if (!this.y.red) this.y = this.y.toRed(this.curve.red);
46852 if (!this.curve.endo) return;
46855 var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
46858 var curve = this.curve;
46861 return curve.point(p.x.redMul(curve.endo.beta), p.y);
46895 Point.fromJSON = function fromJSON(curve, obj, red) {
46897 var res = curve.point(obj[0], obj[1], red);
46901 return curve.point(obj[0], obj[1], red);
46936 if (this.neg().eq(p)) return this.curve.point(null, null); // P + Q = O
46938 if (this.x.cmp(p.x) === 0) return this.curve.point(null, null);
46943 return this.curve.point(nx, ny);
46950 if (ys1.cmpn(0) === 0) return this.curve.point(null, null);
46951 var a = this.curve.a;
46957 return this.curve.point(nx, ny);
46970 …)) return this.curve._fixedNafMul(this, k);else if (this.curve.endo) return this.curve._endoWnafMu…
46976 …if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs);else return this.curve._wna…
46982 …if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs, true);else return this.curv…
46991 var res = this.curve.point(this.x, this.y.redNeg());
47016 if (this.inf) return this.curve.jpoint(null, null, null);
47017 var res = this.curve.jpoint(this.x, this.y, this.curve.one);
47021 function JPoint(curve, x, y, z) {
47022 Base.BasePoint.call(this, curve, 'jacobian');
47025 this.x = this.curve.one;
47026 this.y = this.curve.one;
47034 if (!this.x.red) this.x = this.x.toRed(this.curve.red);
47035 if (!this.y.red) this.y = this.y.toRed(this.curve.red);
47036 if (!this.z.red) this.z = this.z.toRed(this.curve.red);
47037 this.zOne = this.z === this.curve.one;
47047 if (this.isInfinity()) return this.curve.point(null, null);
47052 return this.curve.point(ax, ay);
47056 return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
47075 if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl();
47084 return this.curve.jpoint(nx, ny, nz);
47102 if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl();
47111 return this.curve.jpoint(nx, ny, nz);
47119 if (this.curve.zeroA || this.curve.threeA) {
47131 var a = this.curve.a;
47132 var tinv = this.curve.tinv;
47157 return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
47162 …if (this.curve.zeroA) return this._zeroDbl();else if (this.curve.threeA) return this._threeDbl();e…
47227 return this.curve.jpoint(nx, ny, nz);
47249 var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); // T = M^2 - 2 * S
47288 return this.curve.jpoint(nx, ny, nz);
47292 var a = this.curve.a; // 4M + 6S + 10A
47312 return this.curve.jpoint(nx, ny, nz);
47316 …if (!this.curve.zeroA) return this.dbl().add(this); // hyperelliptic.org/EFD/g1p/auto-shortw-jacob…
47359 return this.curve.jpoint(nx, ny, nz);
47364 return this.curve._wnafMul(this, k);
47382 var rx = x.toRed(this.curve.red).redMul(zs);
47385 var t = this.curve.redN.redMul(zs);
47388 xc.iadd(this.curve.n);
47389 if (xc.cmp(this.curve.p) >= 0) return false;
47412 var curve = require('./curve');
47419 …') this.curve = new curve.short(options);else if (options.type === 'edwards') this.curve = new cur…
47420 this.g = this.curve.g;
47421 this.n = this.curve.n;
47434 var curve = new PresetCurve(options);
47438 value: curve
47440 return curve;
47587 curve: options
47589 this.curve = options.curve.curve;
47590 this.n = this.curve.n;
47592 this.g = this.curve.g; // Point on curve
47594 this.g = options.curve.g;
47595 this.g.precompute(options.curve.n.bitLength() + 1); // Hash for function for DRBG
47597 this.hash = options.hash || options.curve.hash;
47708 if (!this.curve._maxwellTrick) {
47734 …if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) throw new Error('Unable to find se…
47736 …if (isSecondKey) r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);else r = this.curve.pointF…
47810 if (!pub.mul(this.ec.curve.n).isInfinity()) return {
47840 this.priv = this.priv.umod(this.ec.curve.n);
47848 if (this.ec.curve.type === 'mont') {
47850 } else if (this.ec.curve.type === 'short' || this.ec.curve.type === 'edwards') {
47854 this.pub = this.ec.curve.point(key.x, key.y);
47858 this.pub = this.ec.curve.decodePoint(key, enc);
48077 function EDDSA(curve) {
48078 assert(curve === 'ed25519', 'only tested with ed25519 so far');
48079 if (!(this instanceof EDDSA)) return new EDDSA(curve);
48080 var curve = curves[curve].curve;
48081 this.curve = curve;
48082 this.g = curve.g;
48083 this.g.precompute(curve.n.bitLength() + 1);
48084 this.pointClass = curve.point().constructor;
48085 this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
48103 var S = r.add(s_).umod(this.curve.n);
48135 return utils.intFromLE(hash.digest()).umod(this.curve.n);
48172 return this.curve.pointFromY(y, xIsOdd);
70174 curve: ndata.algorithm.curve,
70206 curve: data.parameters.value,