diff options
Diffstat (limited to 'src/js/entropy.js')
-rw-r--r-- | src/js/entropy.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/js/entropy.js b/src/js/entropy.js index a4c7622..62b2711 100644 --- a/src/js/entropy.js +++ b/src/js/entropy.js | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | window.Entropy = new (function() { | 17 | window.Entropy = new (function() { |
18 | 18 | ||
19 | var TWO = new BigInteger(2); | 19 | var TWO = new libs.BigInteger.BigInteger(2); |
20 | 20 | ||
21 | // matchers returns an array of the matched events for each type of entropy. | 21 | // matchers returns an array of the matched events for each type of entropy. |
22 | // eg | 22 | // eg |
@@ -103,11 +103,11 @@ window.Entropy = new (function() { | |||
103 | // Convert base.ints to BigInteger. | 103 | // Convert base.ints to BigInteger. |
104 | // Due to using unusual bases, eg cards of base52, this is not as simple as | 104 | // Due to using unusual bases, eg cards of base52, this is not as simple as |
105 | // using BigInteger.parse() | 105 | // using BigInteger.parse() |
106 | var entropyInt = BigInteger.ZERO; | 106 | var entropyInt = libs.BigInteger.BigInteger.ZERO; |
107 | for (var i=base.ints.length-1; i>=0; i--) { | 107 | for (var i=base.ints.length-1; i>=0; i--) { |
108 | var thisInt = BigInteger.parse(base.ints[i]); | 108 | var thisInt = libs.BigInteger.BigInteger.parse(base.ints[i]); |
109 | var power = (base.ints.length - 1) - i; | 109 | var power = (base.ints.length - 1) - i; |
110 | var additionalEntropy = BigInteger.parse(base.asInt).pow(power).multiply(thisInt); | 110 | var additionalEntropy = libs.BigInteger.BigInteger.parse(base.asInt).pow(power).multiply(thisInt); |
111 | entropyInt = entropyInt.add(additionalEntropy); | 111 | entropyInt = entropyInt.add(additionalEntropy); |
112 | } | 112 | } |
113 | // Convert entropy to binary | 113 | // Convert entropy to binary |
@@ -328,7 +328,7 @@ window.Entropy = new (function() { | |||
328 | // Math.LOG2E | 328 | // Math.LOG2E |
329 | // log2(8) gave 2.9999999999999996 which when floored causes issues. | 329 | // log2(8) gave 2.9999999999999996 which when floored causes issues. |
330 | // So instead use the BigInteger library to get it right. | 330 | // So instead use the BigInteger library to get it right. |
331 | return BigInteger.log(x) / BigInteger.log(2); | 331 | return libs.BigInteger.BigInteger.log(x) / libs.BigInteger.BigInteger.log(2); |
332 | }; | 332 | }; |
333 | 333 | ||
334 | // Depends on BigInteger | 334 | // Depends on BigInteger |
@@ -336,9 +336,9 @@ window.Entropy = new (function() { | |||
336 | if (n == 0) { | 336 | if (n == 0) { |
337 | return 1; | 337 | return 1; |
338 | } | 338 | } |
339 | f = BigInteger.ONE; | 339 | f = libs.BigInteger.BigInteger.ONE; |
340 | for (var i=1; i<=n; i++) { | 340 | for (var i=1; i<=n; i++) { |
341 | f = f.multiply(new BigInteger(i)); | 341 | f = f.multiply(new libs.BigInteger.BigInteger(i)); |
342 | } | 342 | } |
343 | return f; | 343 | return f; |
344 | } | 344 | } |