]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blobdiff - bip39-standalone.html
Entropy is left-padded to 256 bits
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / bip39-standalone.html
index afef084e9264e880e2291807f148b7525cf021e9..3b4f0f27de389dab22a7e9812380e3754fc69abd 100644 (file)
@@ -19488,7 +19488,7 @@ window.Entropy = new (function() {
             var hash = sjcl.hash.sha256.hash(entropy.cleanStr);
             var hex = sjcl.codec.hex.fromBits(hash);
             bits = BigInteger.parse(hex, 16).toString(2);
-            for (var i=0; i<256-bits.length; i++) {
+            while (bits.length % 256 != 0) {
                 bits = "0" + bits;
             }
             // Truncate hash to suit number of words