Removes ecdsa.getBigRandom

This commit is contained in:
Daniel Cousens 2014-04-22 02:04:56 +10:00
parent fb6c76a976
commit 96ebb65099
2 changed files with 3 additions and 8 deletions

View file

@ -52,11 +52,6 @@ function deterministicGenerateK(hash,key) {
} }
var ecdsa = { var ecdsa = {
getBigRandom: function (limit) {
return new BigInteger(limit.bitLength(), rng).
mod(limit.subtract(BigInteger.ONE)).
add(BigInteger.ONE)
},
sign: function (hash, priv) { sign: function (hash, priv) {
var d = priv var d = priv
var n = ecparams.getN() var n = ecparams.getN()

View file

@ -1,21 +1,21 @@
var assert = require('assert') var assert = require('assert')
var ecdsa = require('../').ecdsa
var sec = require('../src/jsbn/sec') var sec = require('../src/jsbn/sec')
var ecparams = sec('secp256k1') var ecparams = sec('secp256k1')
var BigInteger = require('..').BigInteger
var ECPointFp = require('../').ECPointFp var ECPointFp = require('../').ECPointFp
var ECKey = require('../').ECKey var ECKey = require('../').ECKey
describe('ec', function() { describe('ec', function() {
describe('ECPointFp', function() { describe('ECPointFp', function() {
it('behaviours correctly', function() { it('behaves correctly', function() {
var G = ecparams.getG() var G = ecparams.getG()
var n = ecparams.getN() var n = ecparams.getN()
assert.ok(G.multiply(n).isInfinity(), "Gn is infinite") assert.ok(G.multiply(n).isInfinity(), "Gn is infinite")
var k = ecdsa.getBigRandom(n) var k = BigInteger.ONE
var P = G.multiply(k) var P = G.multiply(k)
assert.ok(!P.isInfinity(), "kG is not infinite") assert.ok(!P.isInfinity(), "kG is not infinite")
assert.ok(P.isOnCurve(), "kG on curve") assert.ok(P.isOnCurve(), "kG on curve")