]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Add spaces every 11 bits to raw binary of entropy
authorIan Coleman <ian@iancoleman.io>
Sun, 11 Mar 2018 23:22:26 +0000 (10:22 +1100)
committerIan Coleman <ian@iancoleman.io>
Mon, 12 Mar 2018 00:31:41 +0000 (11:31 +1100)
This makes it easier to see that the checksum is missing from the end of
the entropy.

src/js/index.js

index 1707b1617ad8082f4dfa830fa55b2cb55c96bc94..b36e9926cdd96baa71c77f9c076c1d0f281e2e33 100644 (file)
         var entropyTypeStr = getEntropyTypeStr(entropy);
         var wordCount = Math.floor(numberOfBits / 32) * 3;
         var bitsPerEvent = entropy.bitsPerEvent.toFixed(2);
+        var spacedBinaryStr = entropy.binaryStr.match(/.{1,11}/g).join(" " );
         DOM.entropyFiltered.html(entropy.cleanHtml);
         DOM.entropyType.text(entropyTypeStr);
         DOM.entropyCrackTime.text(timeToCrack);
         DOM.entropyEventCount.text(entropy.base.ints.length);
         DOM.entropyBits.text(numberOfBits);
         DOM.entropyWordCount.text(wordCount);
-        DOM.entropyBinary.text(entropy.binaryStr);
+        DOM.entropyBinary.text(spacedBinaryStr);
         DOM.entropyBitsPerEvent.text(bitsPerEvent);
         // detect and warn of filtering
         var rawNoSpaces = DOM.entropy.val().replace(/\s/g, "");