X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fjs%2Fentropy.js;fp=src%2Fjs%2Fentropy.js;h=cf981ff680ceae66c9a51f2dc23c84f1ef26d597;hb=a3d78b7ddc5aa936d42f2952b9bbab5cd5820dfd;hp=c804fdaeba251e9e0bea375df7533295e3564b76;hpb=0d0f07f9374078ba71cf7f81cd6c2ab8df8d4693;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git 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() { // Convert dice to base6 entropy (ie 1-6 to 0-5) // This is done by changing all 6s to 0s if (base.str == "dice") { - var newRawEntropyStr = ""; + var newParts = []; var newInts = []; - for (var i=0; i -1) { - newRawEntropyStr += c; + newParts[i] = base.parts[i]; newInts[i] = base.ints[i]; } else { - newRawEntropyStr += "0"; + newParts[i] = "0"; newInts[i] = 0; } } - rawEntropyStr = newRawEntropyStr; base.str = "base 6 (dice)"; base.ints = newInts; - base.parts = matchers.base6(rawEntropyStr); + base.parts = newParts; base.matcher = matchers.base6; } // Detect empty entropy