Socket
Socket
Sign inDemoInstall

elliptic

Package Overview
Dependencies
7
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.5.1 to 6.5.2

10

lib/elliptic/curve/base.js

@@ -31,2 +31,4 @@ 'use strict';

this._bitLength = this.n ? this.n.bitLength() : 0;
// Generalized Greg Maxwell's trick

@@ -55,3 +57,3 @@ var adjustCount = this.n && this.p.div(this.n);

var naf = getNAF(k, 1);
var naf = getNAF(k, 1, this._bitLength);
var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);

@@ -93,3 +95,3 @@ I /= 3;

// Get NAF form
var naf = getNAF(k, w);
var naf = getNAF(k, w, this._bitLength);

@@ -150,4 +152,4 @@ // Add `this`*(N+1) for every w-NAF index

if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
naf[a] = getNAF(coeffs[a], wndWidth[a]);
naf[b] = getNAF(coeffs[b], wndWidth[b]);
naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);
naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);
max = Math.max(naf[a].length, max);

@@ -154,0 +156,0 @@ max = Math.max(naf[b].length, max);

19

lib/elliptic/utils.js

@@ -15,10 +15,13 @@ 'use strict';

// Represent num in a w-NAF form
function getNAF(num, w) {
var naf = [];
function getNAF(num, w, bits) {
var naf = new Array(Math.max(num.bitLength(), bits) + 1);
naf.fill(0);
var ws = 1 << (w + 1);
var k = num.clone();
while (k.cmpn(1) >= 0) {
for (var i = 0; i < naf.length; i++) {
var z;
var mod = k.andln(ws - 1);
if (k.isOdd()) {
var mod = k.andln(ws - 1);
if (mod > (ws >> 1) - 1)

@@ -32,9 +35,5 @@ z = (ws >> 1) - mod;

}
naf.push(z);
// Optimization, shift by word if possible
var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;
for (var i = 1; i < shift; i++)
naf.push(0);
k.iushrn(shift);
naf[i] = z;
k.iushrn(1);
}

@@ -41,0 +40,0 @@

{
"name": "elliptic",
"version": "6.5.1",
"version": "6.5.2",
"description": "EC cryptography",

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

"brfs": "^1.4.3",
"coveralls": "^3.0.4",
"coveralls": "^3.0.8",
"grunt": "^1.0.4",

@@ -47,4 +47,4 @@ "grunt-browserify": "^5.0.0",

"jscs": "^3.0.7",
"jshint": "^2.6.0",
"mocha": "^6.1.4"
"jshint": "^2.10.3",
"mocha": "^6.2.2"
},

@@ -51,0 +51,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc