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 0.5.0 to 0.6.0

.travis.yml

14

1.js

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

console.log(keys);
var msg = new elliptic.bn('deadbeef', 16);
var msg = 'deadbeef';
console.time('validate');
var v = ecdsa.validateKey(keys.pub);
var v = keys.validate();
assert(v.result, v.reason);

@@ -24,6 +24,6 @@ console.timeEnd('validate');

console.time('sign');
var signature = ecdsa.sign(msg, keys.priv, 'der');
var signature = ecdsa.sign(msg, keys, 'der');
console.timeEnd('sign');
console.time('verify');
assert(ecdsa.verify(msg, signature, keys.pub));
assert(ecdsa.verify(msg, signature, keys));
console.timeEnd('verify');

@@ -36,3 +36,3 @@

console.time('verify 2');
assert(!ecdsa.verify(msg, signature, keys.pub));
assert(!ecdsa.verify(msg, signature, keys));
console.timeEnd('verify 2');

@@ -42,4 +42,4 @@

console.time('verify 3');
for (var i = 0; i < 80; i++)
assert(!ecdsa.verify(msg, signature, keys.pub));
for (var i = 0; i < 10; i++)
assert(!ecdsa.verify(msg, signature, keys));
console.timeEnd('verify 3');

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

Curve.isPoint = function isPoint(p) {
return p instanceof Point;
};
Curve.prototype.point = function point(x, y, isMont) {

@@ -15,0 +19,0 @@ return new Point(this, x, y, isMont);

@@ -112,6 +112,3 @@ var assert = require('assert');

this.reseed++;
if (enc === 'hex')
return utils.toHex(res);
else
return res;
return utils.encode(res, enc);
};

@@ -45,2 +45,9 @@ var assert = require('assert');

utils.encode = function encode(arr, enc) {
if (enc === 'hex')
return toHex(arr);
else
return arr;
};
function zero2(word) {

@@ -47,0 +54,0 @@ if (word.length === 1)

{
"name": "elliptic",
"version": "0.5.0",
"version": "0.6.0",
"description": "EC cryptography",

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

@@ -1,2 +0,2 @@

# Elliptic
# Elliptic [![Build Status](https://secure.travis-ci.org/indutny/elliptic.png)](http://travis-ci.org/indutny/elliptic)

@@ -3,0 +3,0 @@ Just a bike-shed.

@@ -14,9 +14,21 @@ var assert = require('assert');

// Get keys out of pair
assert(keys.getPublic().x && keys.getPublic().y);
assert(keys.getPrivate().length > 0);
assert(keys.getPublic('hex').length > 0);
assert(keys.getPrivate('hex').length > 0);
// Sign and verify
var signature = ecdsa.sign(msg, keys.priv);
assert(ecdsa.verify(msg, signature, keys.pub));
var signature = ecdsa.sign(msg, keys);
assert(ecdsa.verify(msg, signature, keys), 'Normal verify');
// DER encoding
var dsign = signature.toDER('hex');
assert(ecdsa.verify(msg, dsign, keys), 'hex-DER encoded verify');
var dsign = signature.toDER();
assert(ecdsa.verify(msg, dsign, keys), 'DER encoded verify');
// Wrong public key
var keys = ecdsa.genKeyPair();
assert(!ecdsa.verify(msg, signature, keys.pub));
assert(!ecdsa.verify(msg, signature, keys), 'Wrong key verify');
});

@@ -38,3 +50,3 @@

assert.equal(sign.s.toString(16), c.s);
assert.ok(ecdsa.validateKey(opt.pub),
assert.ok(ecdsa.keyPair(opt.pub).validate().result,
'Invalid public key');

@@ -41,0 +53,0 @@ assert.ok(ecdsa.verify(dgst, sign, opt.pub),

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