diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/js/entropy.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/js/entropy.js b/src/js/entropy.js index c804fda..cf981ff 100644 --- a/src/js/entropy.js +++ b/src/js/entropy.js | |||
@@ -70,23 +70,22 @@ window.Entropy = new (function() { | |||
70 | // Convert dice to base6 entropy (ie 1-6 to 0-5) | 70 | // Convert dice to base6 entropy (ie 1-6 to 0-5) |
71 | // This is done by changing all 6s to 0s | 71 | // This is done by changing all 6s to 0s |
72 | if (base.str == "dice") { | 72 | if (base.str == "dice") { |
73 | var newRawEntropyStr = ""; | 73 | var newParts = []; |
74 | var newInts = []; | 74 | var newInts = []; |
75 | for (var i=0; i<rawEntropyStr.length; i++) { | 75 | for (var i=0; i<base.parts.length; i++) { |
76 | var c = rawEntropyStr[i]; | 76 | var c = base.parts[i]; |
77 | if ("12345".indexOf(c) > -1) { | 77 | if ("12345".indexOf(c) > -1) { |
78 | newRawEntropyStr += c; | 78 | newParts[i] = base.parts[i]; |
79 | newInts[i] = base.ints[i]; | 79 | newInts[i] = base.ints[i]; |
80 | } | 80 | } |
81 | else { | 81 | else { |
82 | newRawEntropyStr += "0"; | 82 | newParts[i] = "0"; |
83 | newInts[i] = 0; | 83 | newInts[i] = 0; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | rawEntropyStr = newRawEntropyStr; | ||
87 | base.str = "base 6 (dice)"; | 86 | base.str = "base 6 (dice)"; |
88 | base.ints = newInts; | 87 | base.ints = newInts; |
89 | base.parts = matchers.base6(rawEntropyStr); | 88 | base.parts = newParts; |
90 | base.matcher = matchers.base6; | 89 | base.matcher = matchers.base6; |
91 | } | 90 | } |
92 | // Detect empty entropy | 91 | // Detect empty entropy |