X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fjs%2Fentropy.js;h=8e29d40824237365b41dd543d21b5e90f91f78ab;hb=425b75a925717eb6f9813503569592a8160c5f34;hp=92300afa352f27b48a1f600705fe5e04fe1383bc;hpb=adc8ce127d4f8ea0d7e5ede6a82c2791d60ff4d2;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git 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() { // Find type of entropy being used (binary, hex, dice etc) var base = getBase(rawEntropyStr); // 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 = ""; for (var i=0; i -1) { - newRawEntropyStr += (parseInt(c) - 1).toString(); + if ("12345".indexOf(c) > -1) { + newRawEntropyStr += c; } else { - newRawEntropyStr += c + newRawEntropyStr += "0"; } } rawEntropyStr = newRawEntropyStr;