Comparing version 0.1.17 to 0.1.18
{ | ||
"name": "bitcore", | ||
"main": "browser/bundle.js", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"homepage": "http://bitcore.io", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -102,3 +102,3 @@ var ECKey = require('../../browser/vendor-bundle.js').ECKey; | ||
var a = bufferToArray(SecureRandom.getRandomBuffer(array.length)); | ||
for (var i in array) { | ||
for (var i in a) { | ||
array[i] = a[i]; | ||
@@ -105,0 +105,0 @@ } |
{ | ||
"name": "bitcore", | ||
"description": "Bitcoin Library", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Stephen Pair", |
@@ -133,2 +133,35 @@ var chai = chai || require('chai'); | ||
describe('generateSync', function() { | ||
it('should not generate the same key twice in a row', function() { | ||
var key1 = Key.generateSync(); | ||
var key2 = Key.generateSync(); | ||
key1.private.toString('hex').should.not.equal(key2.private.toString('hex')); | ||
}); | ||
}); | ||
describe('signSync', function() { | ||
it('should not generate the same signature twice in a row', function() { | ||
var hash = coinUtil.sha256('my data'); | ||
var key = new Key(); | ||
key.private = coinUtil.sha256('a fake private key'); | ||
key.regenerateSync(); | ||
var sig1 = key.signSync(hash); | ||
var sig2 = key.signSync(hash); | ||
sig1.toString('hex').should.not.equal(sig2.toString('hex')); | ||
}); | ||
it('should sign 10 times and have a different signature each time', function() { | ||
var key = new Key(); | ||
key.private = coinUtil.sha256('my fake private key'); | ||
key.regenerateSync(); | ||
var data = coinUtil.sha256('the data i am signing'); | ||
var sigs = []; | ||
for (var i = 0; i < 10; i++) | ||
sigs[i] = key.signSync(data); | ||
for (var i = 0; i < 10; i++) | ||
for (var j = i + 1; j < 10; j++) | ||
sigs[i].toString('hex').should.not.equal(sigs[j].toString('hex')); | ||
}); | ||
}); | ||
}); |
@@ -16,2 +16,11 @@ 'use strict'; | ||
}); | ||
it('should not sign a message the same way twice', function() { | ||
var key = new bitcore.Key(); | ||
key.private = coinUtil.sha256('a fake private key'); | ||
key.regenerateSync(); | ||
var sig1 = Message.sign('my message', key); | ||
var sig2 = Message.sign('my message', key); | ||
sig1.toString('hex').should.not.equal(sig2.toString('hex')); | ||
}); | ||
}); | ||
@@ -18,0 +27,0 @@ |
@@ -25,2 +25,11 @@ 'use strict'; | ||
it('should generate 1000 8 byte buffers in a row that are not equal', function() { | ||
var bufs = []; | ||
for (var i = 0; i < 100; i++) | ||
bufs[i] = SecureRandom.getRandomBuffer(8); | ||
for (var i = 0; i < 100; i++) | ||
for (var j = i + 1; j < 100; j++) | ||
bufs[i].toString('hex').should.not.equal(bufs[j].toString('hex')); | ||
}); | ||
}); | ||
@@ -27,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
923280
18282