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.0.0 to 4.1.0

4

lib/elliptic/ec/key.js

@@ -139,4 +139,4 @@ 'use strict';

// ECDSA
KeyPair.prototype.sign = function sign(msg) {
return this.ec.sign(msg, this);
KeyPair.prototype.sign = function sign(msg, enc, options) {
return this.ec.sign(msg, this, enc, options);
};

@@ -143,0 +143,0 @@

@@ -64,5 +64,4 @@ 'use strict';

var hash = this.hash();
for (var i = 0; i < arguments.length; i++) {
for (var i = 0; i < arguments.length; i++)
hash.update(arguments[i]);
}
return utils.intFromLE(hash.digest()).mod(this.curve.n);

@@ -94,7 +93,16 @@ };

EDDSA.prototype.encodePoint = function encodePoint(point) {
return utils.pointToLEYoddX(point, this.encodingLength);
var enc = utils.intToLE(point.getY(), this.encodingLength);
enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
return enc;
};
EDDSA.prototype.decodePoint = function decodePoint(bytes) {
return utils.pointFromLEYoddX(this.curve, bytes, bytes.length);
bytes = utils.parseBytes(bytes);
var lastIx = bytes.length - 1;
var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
var y = utils.intFromLE(normed);
return this.curve.pointFromY(y, xIsOdd);
};

@@ -101,0 +109,0 @@

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

if (pub instanceof KeyPair)
return pub;
return pub;
return new KeyPair(eddsa, { pub: pub });

@@ -32,0 +32,0 @@ };

@@ -180,23 +180,1 @@ 'use strict';

utils.intToLE = intToLE;
function pointToLEYoddX(point, length) {
var enc = intToLE(point.getY(), length);
enc[length - 1] |= point.getX().isOdd() ? 0x80 : 0;
return enc;
}
utils.pointToLEYoddX = pointToLEYoddX;
function pointFromLEYoddX(curve, bytes, expectedLength) {
bytes = parseBytes(bytes);
if (expectedLength !== undefined)
utils.assert(bytes.length === expectedLength);
var lastIx = bytes.length - 1;
var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
var xIsOdd = Boolean(bytes[lastIx] & 0x80);
var y = intFromLE(normed);
return curve.pointFromY(y, xIsOdd);
}
utils.pointFromLEYoddX = pointFromLEYoddX;
{
"name": "elliptic",
"version": "4.0.0",
"version": "4.1.0",
"description": "EC cryptography",

@@ -5,0 +5,0 @@ "main": "lib/elliptic.js",

@@ -41,2 +41,6 @@ var assert = require('assert');

// key.sign(msg, options)
var sign = keys.sign('hello', { canonical: true });
assert.notEqual(sign.toDER('hex'), keys.sign('hello').toDER('hex'));
// Load public key from compact hex

@@ -43,0 +47,0 @@ var keys = ecdsa.keyFromPublic(keys.getPublic(true, 'hex'), 'hex');

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