upgrade bigi & remove monkey patching
This commit is contained in:
parent
39516d5532
commit
af1f121fd4
13 changed files with 12 additions and 95 deletions
46
test/bigi.js
46
test/bigi.js
|
@ -1,46 +0,0 @@
|
|||
var assert = require('assert')
|
||||
var BigInteger = require('../').BigInteger
|
||||
|
||||
var fixtures = require('./fixtures/bigi')
|
||||
|
||||
describe('BigInteger', function() {
|
||||
describe('fromBuffer/fromHex', function() {
|
||||
it('should match the test vectors', function() {
|
||||
fixtures.valid.forEach(function(f) {
|
||||
assert.equal(BigInteger.fromHex(f.hex).toString(), f.dec)
|
||||
assert.equal(BigInteger.fromHex(f.hexPadded).toString(), f.dec)
|
||||
})
|
||||
})
|
||||
|
||||
fixtures.invalid.forEach(function(f) {
|
||||
it('throws on ' + f.description, function() {
|
||||
assert.throws(function() {
|
||||
BigInteger.fromHex(f.string)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('toBuffer/toHex', function() {
|
||||
it('should match the test vectors', function() {
|
||||
fixtures.valid.forEach(function(f) {
|
||||
var bi = new BigInteger(f.dec)
|
||||
|
||||
assert.equal(bi.toHex(), f.hex)
|
||||
assert.equal(bi.toHex(32), f.hexPadded)
|
||||
})
|
||||
})
|
||||
|
||||
it('throws on non-finite padding value', function() {
|
||||
var bi = new BigInteger('1')
|
||||
|
||||
assert.throws(function() { bi.toHex({}) })
|
||||
assert.throws(function() { bi.toHex([]) })
|
||||
assert.throws(function() { bi.toHex('') })
|
||||
assert.throws(function() { bi.toHex(0 / 0) })
|
||||
assert.throws(function() { bi.toHex(1 / 0) })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
module.exports = BigInteger
|
|
@ -3,7 +3,7 @@ var assert = require('assert')
|
|||
var sec = require('../').sec
|
||||
var ecparams = sec('secp256k1')
|
||||
|
||||
var BigInteger = require('..').BigInteger
|
||||
var BigInteger = require('bigi')
|
||||
var ECPointFp = require('../').ECPointFp
|
||||
|
||||
describe('ec', function() {
|
||||
|
|
|
@ -4,7 +4,7 @@ var ecdsa = require('..').ecdsa
|
|||
var sec = require('..').sec
|
||||
var ecparams = sec("secp256k1")
|
||||
|
||||
var BigInteger = require('..').BigInteger
|
||||
var BigInteger = require('bigi')
|
||||
var ECKey = require('..').ECKey
|
||||
var ECPubKey = require('..').ECPubKey
|
||||
var Message = require('..').Message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue