diff options
author | Ian Coleman <ian@iancoleman.io> | 2018-03-12 10:22:26 +1100 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2018-03-12 11:31:41 +1100 |
commit | d6cade868f67c10da6fcf20e51643439e9d3be77 (patch) | |
tree | c2b776acd6facb76d510a46c407953dbe478fd82 /src | |
parent | 048721a6ff08555de71626d9868aa5054b46cfda (diff) | |
download | BIP39-d6cade868f67c10da6fcf20e51643439e9d3be77.tar.gz BIP39-d6cade868f67c10da6fcf20e51643439e9d3be77.tar.zst BIP39-d6cade868f67c10da6fcf20e51643439e9d3be77.zip |
Add spaces every 11 bits to raw binary of entropy
This makes it easier to see that the checksum is missing from the end of
the entropy.
Diffstat (limited to 'src')
-rw-r--r-- | src/js/index.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/js/index.js b/src/js/index.js index 1707b16..b36e992 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -1225,13 +1225,14 @@ | |||
1225 | var entropyTypeStr = getEntropyTypeStr(entropy); | 1225 | var entropyTypeStr = getEntropyTypeStr(entropy); |
1226 | var wordCount = Math.floor(numberOfBits / 32) * 3; | 1226 | var wordCount = Math.floor(numberOfBits / 32) * 3; |
1227 | var bitsPerEvent = entropy.bitsPerEvent.toFixed(2); | 1227 | var bitsPerEvent = entropy.bitsPerEvent.toFixed(2); |
1228 | var spacedBinaryStr = entropy.binaryStr.match(/.{1,11}/g).join(" " ); | ||
1228 | DOM.entropyFiltered.html(entropy.cleanHtml); | 1229 | DOM.entropyFiltered.html(entropy.cleanHtml); |
1229 | DOM.entropyType.text(entropyTypeStr); | 1230 | DOM.entropyType.text(entropyTypeStr); |
1230 | DOM.entropyCrackTime.text(timeToCrack); | 1231 | DOM.entropyCrackTime.text(timeToCrack); |
1231 | DOM.entropyEventCount.text(entropy.base.ints.length); | 1232 | DOM.entropyEventCount.text(entropy.base.ints.length); |
1232 | DOM.entropyBits.text(numberOfBits); | 1233 | DOM.entropyBits.text(numberOfBits); |
1233 | DOM.entropyWordCount.text(wordCount); | 1234 | DOM.entropyWordCount.text(wordCount); |
1234 | DOM.entropyBinary.text(entropy.binaryStr); | 1235 | DOM.entropyBinary.text(spacedBinaryStr); |
1235 | DOM.entropyBitsPerEvent.text(bitsPerEvent); | 1236 | DOM.entropyBitsPerEvent.text(bitsPerEvent); |
1236 | // detect and warn of filtering | 1237 | // detect and warn of filtering |
1237 | var rawNoSpaces = DOM.entropy.val().replace(/\s/g, ""); | 1238 | var rawNoSpaces = DOM.entropy.val().replace(/\s/g, ""); |