+5
-6
lines changedFilter options
+5
-6
lines changed Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ function DSA() {
49
49
// or s = 0 if signatures are generated properly.
50
50
var k, s1, s2;
51
51
while (true) {
52
-
k = random.getRandomBigIntegerInRange(BigInteger.ONE.add(BigInteger.ONE), q.subtract(BigInteger.ONE));
52
+
k = random.getRandomBigIntegerInRange(BigInteger.ONE, q.subtract(BigInteger.ONE));
53
53
s1 = (g.modPow(k, p)).mod(q);
54
54
s2 = (k.modInverse(q).multiply(hash.add(x.multiply(s1)))).mod(q);
55
55
if (s1 != 0 && s2 != 0) {
Original file line number Diff line number Diff line change
@@ -32,9 +32,8 @@ function Elgamal() {
32
32
33
33
function encrypt(m, g, p, y) {
34
34
// choose k in {2,...,p-2}
35
-
var two = BigInteger.ONE.add(BigInteger.ONE);
36
-
var pMinus2 = p.subtract(two);
37
-
var k = random.getRandomBigIntegerInRange(two, pMinus2);
35
+
var pMinus2 = p.subtract(BigInteger.TWO);
36
+
var k = random.getRandomBigIntegerInRange(BigInteger.ONE, pMinus2);
38
37
k = k.mod(pMinus2).add(BigInteger.ONE);
39
38
var c = [];
40
39
c[0] = g.modPow(k, p);
Original file line number Diff line number Diff line change
@@ -730,6 +730,7 @@ BigInteger.prototype.modPowInt = bnModPowInt;
730
730
// "constants"
731
731
BigInteger.ZERO = nbv(0);
732
732
BigInteger.ONE = nbv(1);
733
+
BigInteger.TWO = nbv(2);
733
734
734
735
module.exports = BigInteger;
735
736
Original file line number Diff line number Diff line change
@@ -40,13 +40,12 @@ function SecureRandom() {
40
40
41
41
var blinder = BigInteger.ZERO;
42
42
var unblinder = BigInteger.ZERO;
43
-
var TWO = BigInteger.ONE.add(BigInteger.ONE);
44
43
45
44
function blind(m, n, e) {
46
45
if (unblinder.bitLength() === n.bitLength()) {
47
46
unblinder = unblinder.square().mod(n);
48
47
} else {
49
-
unblinder = random.getRandomBigIntegerInRange(TWO, n);
48
+
unblinder = random.getRandomBigIntegerInRange(BigInteger.TWO, n);
50
49
}
51
50
blinder = unblinder.modInverse(n).modPow(e, n);
52
51
return m.multiply(blinder).mod(n);
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4