Removes ecdsa.getBigRandom
This commit is contained in:
parent
fb6c76a976
commit
96ebb65099
2 changed files with 3 additions and 8 deletions
|
@ -52,11 +52,6 @@ function deterministicGenerateK(hash,key) {
|
|||
}
|
||||
|
||||
var ecdsa = {
|
||||
getBigRandom: function (limit) {
|
||||
return new BigInteger(limit.bitLength(), rng).
|
||||
mod(limit.subtract(BigInteger.ONE)).
|
||||
add(BigInteger.ONE)
|
||||
},
|
||||
sign: function (hash, priv) {
|
||||
var d = priv
|
||||
var n = ecparams.getN()
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
var assert = require('assert')
|
||||
var ecdsa = require('../').ecdsa
|
||||
|
||||
var sec = require('../src/jsbn/sec')
|
||||
var ecparams = sec('secp256k1')
|
||||
|
||||
var BigInteger = require('..').BigInteger
|
||||
var ECPointFp = require('../').ECPointFp
|
||||
var ECKey = require('../').ECKey
|
||||
|
||||
describe('ec', function() {
|
||||
describe('ECPointFp', function() {
|
||||
it('behaviours correctly', function() {
|
||||
it('behaves correctly', function() {
|
||||
var G = ecparams.getG()
|
||||
var n = ecparams.getN()
|
||||
|
||||
assert.ok(G.multiply(n).isInfinity(), "Gn is infinite")
|
||||
|
||||
var k = ecdsa.getBigRandom(n)
|
||||
var k = BigInteger.ONE
|
||||
var P = G.multiply(k)
|
||||
assert.ok(!P.isInfinity(), "kG is not infinite")
|
||||
assert.ok(P.isOnCurve(), "kG on curve")
|
||||
|
|
Loading…
Reference in a new issue