aboutsummaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/entropy.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/js/entropy.js b/src/js/entropy.js
index 92300af..8e29d40 100644
--- a/src/js/entropy.js
+++ b/src/js/entropy.js
@@ -68,15 +68,16 @@ window.Entropy = new (function() {
68 // Find type of entropy being used (binary, hex, dice etc) 68 // Find type of entropy being used (binary, hex, dice etc)
69 var base = getBase(rawEntropyStr); 69 var base = getBase(rawEntropyStr);
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 if (base.str == "dice") { 72 if (base.str == "dice") {
72 var newRawEntropyStr = ""; 73 var newRawEntropyStr = "";
73 for (var i=0; i<rawEntropyStr.length; i++) { 74 for (var i=0; i<rawEntropyStr.length; i++) {
74 var c = rawEntropyStr[i]; 75 var c = rawEntropyStr[i];
75 if ("123456".indexOf(c) > -1) { 76 if ("12345".indexOf(c) > -1) {
76 newRawEntropyStr += (parseInt(c) - 1).toString(); 77 newRawEntropyStr += c;
77 } 78 }
78 else { 79 else {
79 newRawEntropyStr += c 80 newRawEntropyStr += "0";
80 } 81 }
81 } 82 }
82 rawEntropyStr = newRawEntropyStr; 83 rawEntropyStr = newRawEntropyStr;