diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/js/index.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/js/index.js b/src/js/index.js index 0d573ba..b8a76a9 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -1228,7 +1228,7 @@ | |||
1228 | var entropyTypeStr = getEntropyTypeStr(entropy); | 1228 | var entropyTypeStr = getEntropyTypeStr(entropy); |
1229 | var wordCount = Math.floor(numberOfBits / 32) * 3; | 1229 | var wordCount = Math.floor(numberOfBits / 32) * 3; |
1230 | var bitsPerEvent = entropy.bitsPerEvent.toFixed(2); | 1230 | var bitsPerEvent = entropy.bitsPerEvent.toFixed(2); |
1231 | var spacedBinaryStr = entropy.binaryStr.match(/.{1,11}/g).join(" " ); | 1231 | var spacedBinaryStr = addSpacesEveryElevenBits(entropy.binaryStr); |
1232 | DOM.entropyFiltered.html(entropy.cleanHtml); | 1232 | DOM.entropyFiltered.html(entropy.cleanHtml); |
1233 | DOM.entropyType.text(entropyTypeStr); | 1233 | DOM.entropyType.text(entropyTypeStr); |
1234 | DOM.entropyCrackTime.text(timeToCrack); | 1234 | DOM.entropyCrackTime.text(timeToCrack); |
@@ -1479,6 +1479,11 @@ | |||
1479 | var start = binaryStr.length - checksumBitlength; | 1479 | var start = binaryStr.length - checksumBitlength; |
1480 | var end = binaryStr.length; | 1480 | var end = binaryStr.length; |
1481 | checksum = binaryStr.substring(start, end); | 1481 | checksum = binaryStr.substring(start, end); |
1482 | // add spaces so the last group is 11 bits, not the first | ||
1483 | checksum = checksum.split("").reverse().join("") | ||
1484 | checksum = addSpacesEveryElevenBits(checksum); | ||
1485 | checksum = checksum.split("").reverse().join("") | ||
1486 | break; | ||
1482 | } | 1487 | } |
1483 | } | 1488 | } |
1484 | DOM.entropyChecksum.text(checksum); | 1489 | DOM.entropyChecksum.text(checksum); |
@@ -1504,6 +1509,10 @@ | |||
1504 | DOM.csv.val(tableCsv); | 1509 | DOM.csv.val(tableCsv); |
1505 | } | 1510 | } |
1506 | 1511 | ||
1512 | function addSpacesEveryElevenBits(binaryStr) { | ||
1513 | return binaryStr.match(/.{1,11}/g).join(" "); | ||
1514 | } | ||
1515 | |||
1507 | var networks = [ | 1516 | var networks = [ |
1508 | { | 1517 | { |
1509 | name: "AXE - Axe", | 1518 | name: "AXE - Axe", |