Lines Matching refs:red

29469     this.red = null;
29752 dest.red = this.red;
29788 return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
32271 BN.red = function red(num) {
32276 assert(!this.red, 'Already a number in reduction context');
32282 assert(this.red, 'fromRed works only with numbers in reduction context');
32283 return this.red.convertFrom(this);
32287 this.red = ctx;
32292 assert(!this.red, 'Already a number in reduction context');
32297 assert(this.red, 'redAdd works only with red numbers');
32298 return this.red.add(this, num);
32302 assert(this.red, 'redIAdd works only with red numbers');
32303 return this.red.iadd(this, num);
32307 assert(this.red, 'redSub works only with red numbers');
32308 return this.red.sub(this, num);
32312 assert(this.red, 'redISub works only with red numbers');
32313 return this.red.isub(this, num);
32317 assert(this.red, 'redShl works only with red numbers');
32318 return this.red.shl(this, num);
32322 assert(this.red, 'redMul works only with red numbers');
32324 this.red._verify2(this, num);
32326 return this.red.mul(this, num);
32330 assert(this.red, 'redMul works only with red numbers');
32332 this.red._verify2(this, num);
32334 return this.red.imul(this, num);
32338 assert(this.red, 'redSqr works only with red numbers');
32340 this.red._verify1(this);
32342 return this.red.sqr(this);
32346 assert(this.red, 'redISqr works only with red numbers');
32348 this.red._verify1(this);
32350 return this.red.isqr(this);
32355 assert(this.red, 'redSqrt works only with red numbers');
32357 this.red._verify1(this);
32359 return this.red.sqrt(this);
32363 assert(this.red, 'redInvm works only with red numbers');
32365 this.red._verify1(this);
32367 return this.red.invm(this);
32372 assert(this.red, 'redNeg works only with red numbers');
32374 this.red._verify1(this);
32376 return this.red.neg(this);
32380 assert(this.red && !num.red, 'redPow(normalNum)');
32382 this.red._verify1(this);
32384 return this.red.pow(this, num);
32599 assert(a.red, 'red works only with red numbers');
32604 assert(a.red && a.red === b.red, 'red works only with red numbers');
32820 res.red = null;
32855 r.red = null;
33058 this.red = null;
33352 dest.red = this.red;
33359 dest.red = src.red;
33411 return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
35973 BN.red = function red(num) {
35978 assert(!this.red, 'Already a number in reduction context');
35984 assert(this.red, 'fromRed works only with numbers in reduction context');
35985 return this.red.convertFrom(this);
35989 this.red = ctx;
35994 assert(!this.red, 'Already a number in reduction context');
35999 assert(this.red, 'redAdd works only with red numbers');
36000 return this.red.add(this, num);
36004 assert(this.red, 'redIAdd works only with red numbers');
36005 return this.red.iadd(this, num);
36009 assert(this.red, 'redSub works only with red numbers');
36010 return this.red.sub(this, num);
36014 assert(this.red, 'redISub works only with red numbers');
36015 return this.red.isub(this, num);
36019 assert(this.red, 'redShl works only with red numbers');
36020 return this.red.shl(this, num);
36024 assert(this.red, 'redMul works only with red numbers');
36026 this.red._verify2(this, num);
36028 return this.red.mul(this, num);
36032 assert(this.red, 'redMul works only with red numbers');
36034 this.red._verify2(this, num);
36036 return this.red.imul(this, num);
36040 assert(this.red, 'redSqr works only with red numbers');
36042 this.red._verify1(this);
36044 return this.red.sqr(this);
36048 assert(this.red, 'redISqr works only with red numbers');
36050 this.red._verify1(this);
36052 return this.red.isqr(this);
36057 assert(this.red, 'redSqrt works only with red numbers');
36059 this.red._verify1(this);
36061 return this.red.sqrt(this);
36065 assert(this.red, 'redInvm works only with red numbers');
36067 this.red._verify1(this);
36069 return this.red.invm(this);
36074 assert(this.red, 'redNeg works only with red numbers');
36076 this.red._verify1(this);
36078 return this.red.neg(this);
36082 assert(this.red && !num.red, 'redPow(normalNum)');
36084 this.red._verify1(this);
36086 return this.red.pow(this, num);
36301 assert(a.red, 'red works only with red numbers');
36306 assert(a.red && a.red === b.red, 'red works only with red numbers');
36523 res.red = null;
36558 r.red = null;
38604 var red = BN.mont(pub.modulus);
38605 sig = new BN(sig).toRed(red);
45540 var red = BN.mont(p);
45541 return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
45655 this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); // Useful for many curves
45657 this.zero = new BN(0).toRed(this.red);
45658 this.one = new BN(1).toRed(this.red);
45659 this.two = new BN(2).toRed(this.red); // Curve configuration, optional
45676 this.redN = this.n.toRed(this.red);
46021 this.a = new BN(conf.a, 16).umod(this.red.m);
46022 this.a = this.a.toRed(this.red);
46023 this.c = new BN(conf.c, 16).toRed(this.red);
46025 this.d = new BN(conf.d, 16).toRed(this.red);
46049 if (!x.red) x = x.toRed(this.red);
46063 if (!y.red) y = y.toRed(this.red); // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
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);
46362 var rx = x.toRed(this.curve.red).redMul(this.z);
46401 this.a = new BN(conf.a, 16).toRed(this.red);
46402 this.b = new BN(conf.b, 16).toRed(this.red);
46403 this.i4 = new BN(4).toRed(this.red).redInvm();
46404 this.two = new BN(2).toRed(this.red);
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);
46582 this.a = new BN(conf.a, 16).toRed(this.red);
46583 this.b = new BN(conf.b, 16).toRed(this.red);
46604 beta = new BN(conf.beta, 16).toRed(this.red);
46610 beta = beta.toRed(this.red);
46652 var red = num === this.p ? this.red : BN.mont(num);
46653 var tinv = new BN(2).toRed(red).redInvm();
46655 var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
46761 if (!x.red) x = x.toRed(this.red);
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);
46847 ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
46848 return Point.fromJSON(this, obj, red);
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);
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);
47382 var rx = x.toRed(this.curve.red).redMul(zs);
61609 var red = bn.mont(n);
61610 var rone = new bn(1).toRed(red);
61618 var rn1 = n1.toRed(red);
61625 var x = a.toRed(red).redPow(d);
61642 var red = bn.mont(n);
61643 var rone = new bn(1).toRed(red);
61651 var rn1 = n1.toRed(red);
61658 var x = a.toRed(red).redPow(d);