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.3.3 to 6.4.0

1

lib/elliptic.js

@@ -8,3 +8,2 @@ 'use strict';

elliptic.rand = require('brorand');
elliptic.hmacDRBG = require('./elliptic/hmac-drbg');
elliptic.curve = require('./elliptic/curve');

@@ -11,0 +10,0 @@ elliptic.curves = require('./elliptic/curves');

9

lib/elliptic/ec/index.js
'use strict';
var BN = require('bn.js');
var HmacDRBG = require('hmac-drbg');
var elliptic = require('../../elliptic');

@@ -57,6 +58,8 @@ var utils = elliptic.utils;

// Instantiate Hmac_DRBG
var drbg = new elliptic.hmacDRBG({
var drbg = new HmacDRBG({
hash: this.hash,
pers: options.pers,
persEnc: options.persEnc || 'utf8',
entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
entropyEnc: options.entropy && options.entropyEnc || 'utf8',
nonce: this.n.toArray()

@@ -106,3 +109,3 @@ });

// Instantiate Hmac_DRBG
var drbg = new elliptic.hmacDRBG({
var drbg = new HmacDRBG({
hash: this.hash,

@@ -112,3 +115,3 @@ entropy: bkey,

pers: options.pers,
persEnc: options.persEnc
persEnc: options.persEnc || 'utf8'
});

@@ -115,0 +118,0 @@

@@ -5,63 +5,11 @@ 'use strict';

var BN = require('bn.js');
var minAssert = require('minimalistic-assert');
var minUtils = require('minimalistic-crypto-utils');
utils.assert = function assert(val, msg) {
if (!val)
throw new Error(msg || 'Assertion failed');
};
utils.assert = minAssert;
utils.toArray = minUtils.toArray;
utils.zero2 = minUtils.zero2;
utils.toHex = minUtils.toHex;
utils.encode = minUtils.encode;
function toArray(msg, enc) {
if (Array.isArray(msg))
return msg.slice();
if (!msg)
return [];
var res = [];
if (typeof msg !== 'string') {
for (var i = 0; i < msg.length; i++)
res[i] = msg[i] | 0;
return res;
}
if (!enc) {
for (var i = 0; i < msg.length; i++) {
var c = msg.charCodeAt(i);
var hi = c >> 8;
var lo = c & 0xff;
if (hi)
res.push(hi, lo);
else
res.push(lo);
}
} else if (enc === 'hex') {
msg = msg.replace(/[^a-z0-9]+/ig, '');
if (msg.length % 2 !== 0)
msg = '0' + msg;
for (var i = 0; i < msg.length; i += 2)
res.push(parseInt(msg[i] + msg[i + 1], 16));
}
return res;
}
utils.toArray = toArray;
function zero2(word) {
if (word.length === 1)
return '0' + word;
else
return word;
}
utils.zero2 = zero2;
function toHex(msg) {
var res = '';
for (var i = 0; i < msg.length; i++)
res += zero2(msg[i].toString(16));
return res;
}
utils.toHex = toHex;
utils.encode = function encode(arr, enc) {
if (enc === 'hex')
return toHex(arr);
else
return arr;
};
// Represent num in a w-NAF form

@@ -68,0 +16,0 @@ function getNAF(num, w) {

{
"name": "elliptic",
"version": "6.3.3",
"version": "6.4.0",
"description": "EC cryptography",

@@ -53,4 +53,7 @@ "main": "lib/elliptic.js",

"hash.js": "^1.0.0",
"inherits": "^2.0.1"
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
}
}
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