Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elliptic

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elliptic - npm Package Compare versions

Comparing version 4.1.0 to 5.0.0

3

lib/elliptic/curve/edwards.js

@@ -19,3 +19,4 @@ 'use strict';

this.a = new bn(conf.a, 16).mod(this.red.m).toRed(this.red);
this.a = new bn(conf.a, 16).umod(this.red.m);
this.a = this.a.toRed(this.red);
this.c = new bn(conf.c, 16).toRed(this.red);

@@ -22,0 +23,0 @@ this.c2 = this.c.redSqr();

@@ -127,3 +127,3 @@ 'use strict';

for (var bits = []; t.cmpn(0) !== 0; t.ishrn(1))
for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
bits.push(t.andln(1));

@@ -130,0 +130,0 @@

@@ -95,3 +95,3 @@ 'use strict';

// aprxSqrt >= sqrt(this.n)
var aprxSqrt = this.n.shrn(Math.floor(this.n.bitLength() / 2));
var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));

@@ -98,0 +98,0 @@ // 3.74

@@ -28,3 +28,3 @@ 'use strict';

this.n = this.curve.n;
this.nh = this.n.shrn(1);
this.nh = this.n.ushrn(1);
this.g = this.curve.g;

@@ -80,3 +80,3 @@

if (delta > 0)
msg = msg.shrn(delta);
msg = msg.ushrn(delta);
if (!truncOnly && msg.cmp(this.n) >= 0)

@@ -130,7 +130,8 @@ return msg.sub(this.n);

var kpX = kp.getX();
var r = kpX.mod(this.n);
var r = kpX.umod(this.n);
if (r.cmpn(0) === 0)
continue;
var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)).mod(this.n);
var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
s = s.umod(this.n);
if (s.cmpn(0) === 0)

@@ -165,4 +166,4 @@ continue;

var sinv = s.invm(this.n);
var u1 = sinv.mul(msg).mod(this.n);
var u2 = sinv.mul(r).mod(this.n);
var u1 = sinv.mul(msg).umod(this.n);
var u2 = sinv.mul(r).umod(this.n);

@@ -173,3 +174,3 @@ var p = this.g.mulAdd(u1, key.getPublic(), u2);

return p.getX().mod(this.n).cmp(r) === 0;
return p.getX().umod(this.n).cmp(r) === 0;
};

@@ -189,3 +190,3 @@

var isSecondKey = j >> 1;
if (r.cmp(this.curve.p.mod(this.curve.n)) >= 0 && isSecondKey)
if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
throw new Error('Unable to find sencond key candinate');

@@ -195,3 +196,3 @@

r = this.curve.pointFromX(r, isYOdd);
var eNeg = e.neg().mod(n);
var eNeg = e.neg().umod(n);

@@ -198,0 +199,0 @@ // 1.6.1 Compute Q = r^-1 (sR - eG)

@@ -102,3 +102,3 @@ 'use strict';

// in fixed multiplication method
this.priv = this.priv.mod(this.ec.curve.n);
this.priv = this.priv.umod(this.ec.curve.n);
};

@@ -105,0 +105,0 @@

@@ -42,3 +42,3 @@ 'use strict';

.mul(key.priv());
var S = r.add(s_).mod(this.curve.n);
var S = r.add(s_).umod(this.curve.n);
return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });

@@ -67,3 +67,3 @@ };

hash.update(arguments[i]);
return utils.intFromLE(hash.digest()).mod(this.curve.n);
return utils.intFromLE(hash.digest()).umod(this.curve.n);
};

@@ -70,0 +70,0 @@

@@ -89,3 +89,3 @@ 'use strict';

naf.push(0);
k.ishrn(shift);
k.iushrn(shift);
}

@@ -146,4 +146,4 @@

d2 = 1 - d2;
k1.ishrn(1);
k2.ishrn(1);
k1.iushrn(1);
k2.iushrn(1);
}

@@ -150,0 +150,0 @@

{
"name": "elliptic",
"version": "4.1.0",
"version": "5.0.0",
"description": "EC cryptography",

@@ -33,3 +33,3 @@ "main": "lib/elliptic.js",

"dependencies": {
"bn.js": "^2.1.0",
"bn.js": "^3.0.0",
"brorand": "^1.0.1",

@@ -36,0 +36,0 @@ "hash.js": "^1.0.0",

@@ -72,5 +72,5 @@ var assert = require('assert');

var split = curve._endoSplit(k);
assert.equal(
split.k1.add(split.k2.mul(curve.endo.lambda)).mod(curve.n).toString(16),
k.toString(16));
var testK = split.k1.add(split.k2.mul(curve.endo.lambda)).umod(curve.n);
assert.equal(testK.toString(16), k.toString(16));
});

@@ -77,0 +77,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc