diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2016-11-30 19:38:14 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2016-11-30 19:43:14 +1100 |
commit | fc7c248fafef4ba2aecf9dcf4718b3d4c91d94b0 (patch) | |
tree | c510a9cc73a4161d5b8feaf872bcbdfe41c272ea /bip39-standalone.html | |
parent | 94959756408aa60be4118ab1dceff4e71c6afdbf (diff) | |
download | BIP39-fc7c248fafef4ba2aecf9dcf4718b3d4c91d94b0.tar.gz BIP39-fc7c248fafef4ba2aecf9dcf4718b3d4c91d94b0.tar.zst BIP39-fc7c248fafef4ba2aecf9dcf4718b3d4c91d94b0.zip |
Entropy with more than 4 decks can be calculated
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r-- | bip39-standalone.html | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index 4bad422..0da2443 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -18467,7 +18467,12 @@ window.Entropy = new (function() { | |||
18467 | } | 18467 | } |
18468 | // Work out the total number of bits for this many decks | 18468 | // Work out the total number of bits for this many decks |
18469 | // See http://crypto.stackexchange.com/q/41886 | 18469 | // See http://crypto.stackexchange.com/q/41886 |
18470 | var gainedBits = Math.log2(factorial(52 * numberOfDecks)); | 18470 | var gainedBits = 0; |
18471 | // Equivalent of Math.log2(factorial(52*numberOfDecks)) | ||
18472 | // which becomes infinity for numberOfDecks > 4 | ||
18473 | for (var i=1; i<=52*numberOfDecks; i++) { | ||
18474 | gainedBits = gainedBits + Math.log2(i); | ||
18475 | } | ||
18471 | var lostBits = 52 * Math.log2(factorial(numberOfDecks)); | 18476 | var lostBits = 52 * Math.log2(factorial(numberOfDecks)); |
18472 | var maxBits = gainedBits - lostBits; | 18477 | var maxBits = gainedBits - lostBits; |
18473 | // Convert the drawn cards to a binary representation. | 18478 | // Convert the drawn cards to a binary representation. |