Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/ecdsa-modified-1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ KJUR.crypto.ECDSA = function(params) {
//===========================
// PUBLIC METHODS
//===========================
/*
* Generate uniformly distributed big random integer in 0 <= x < limit
*/
this.getBigRandom = function (limit) {
return new _BigInteger(limit.bitLength(), rng)
.mod(limit.subtract(_BigInteger.ONE))
.add(_BigInteger.ONE)
;
var bitLength = limit.subtract(_BigInteger.ONE).bitLength();
do {
var result = new _BigInteger(bitLength, rng);
} while (result.compareTo(limit) >= 0);
return result;
};

this.setNamedCurve = function(curveName) {
Expand Down
Loading