|
|
@ -1,8 +1,7 @@ |
|
|
|
var assert = require('assert') |
|
|
|
var crypto = require('../src/crypto') |
|
|
|
var crypto = require('crypto') |
|
|
|
var crypto2 = require('../src/crypto') |
|
|
|
var networks = require('../src/networks') |
|
|
|
|
|
|
|
var secureRandom = require('secure-random') |
|
|
|
var sinon = require('sinon') |
|
|
|
|
|
|
|
var BigInteger = require('bigi') |
|
|
@ -84,13 +83,13 @@ describe('ECKey', function() { |
|
|
|
var exPrivKey = ECKey.fromWIF(exWIF) |
|
|
|
var exBuffer = exPrivKey.d.toBuffer(32) |
|
|
|
|
|
|
|
describe('using default RNG', function() { |
|
|
|
describe('uses default crypto RNG', function() { |
|
|
|
beforeEach(function() { |
|
|
|
sinon.stub(secureRandom, 'randomBuffer').returns(exBuffer) |
|
|
|
sinon.stub(crypto, 'randomBytes').returns(exBuffer) |
|
|
|
}) |
|
|
|
|
|
|
|
afterEach(function() { |
|
|
|
secureRandom.randomBuffer.restore() |
|
|
|
crypto.randomBytes.restore() |
|
|
|
}) |
|
|
|
|
|
|
|
it('generates a ECKey', function() { |
|
|
@ -116,7 +115,7 @@ describe('ECKey', function() { |
|
|
|
}) |
|
|
|
|
|
|
|
describe('signing', function() { |
|
|
|
var hash = crypto.sha256('Vires in numeris') |
|
|
|
var hash = crypto2.sha256('Vires in numeris') |
|
|
|
var priv = ECKey.makeRandom() |
|
|
|
var signature = priv.sign(hash) |
|
|
|
|
|
|
|