diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/index.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/js/index.js b/src/js/index.js index 035a2b3..9d5f8ee 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -45,6 +45,7 @@ | |||
45 | DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning"); | 45 | DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning"); |
46 | DOM.phrase = $(".phrase"); | 46 | DOM.phrase = $(".phrase"); |
47 | DOM.splitPhrase = $(".phraseSplit"); | 47 | DOM.splitPhrase = $(".phraseSplit"); |
48 | DOM.phraseSplitWarn = $(".phraseSplitWarn"); | ||
48 | DOM.passphrase = $(".passphrase"); | 49 | DOM.passphrase = $(".passphrase"); |
49 | DOM.generateContainer = $(".generate-container"); | 50 | DOM.generateContainer = $(".generate-container"); |
50 | DOM.generate = $(".generate"); | 51 | DOM.generate = $(".generate"); |
@@ -1448,6 +1449,18 @@ | |||
1448 | cards[i]='Card '+(i+1)+': '+wordArrayToPhrase(cards[i]); //combine words on card back to string | 1449 | cards[i]='Card '+(i+1)+': '+wordArrayToPhrase(cards[i]); //combine words on card back to string |
1449 | } | 1450 | } |
1450 | DOM.splitPhrase.val(cards.join("\r\n")); //make words visible | 1451 | DOM.splitPhrase.val(cards.join("\r\n")); //make words visible |
1452 | var triesPerSecond=10000000000; //assumed number of tries per second | ||
1453 | var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond; //get number of bits of unknown data per card | ||
1454 | if (hackTime<1) { | ||
1455 | hackTime="<1 second"; | ||
1456 | } else if (hackTime<86400) { | ||
1457 | hackTime=Math.floor(hackTime)+" seconds"; | ||
1458 | } else if(hackTime<31557600) { | ||
1459 | hackTime=Math.floor(hackTime/86400)+" days"; | ||
1460 | } else { | ||
1461 | hackTime=Math.floor(hackTime/31557600)+" years"; | ||
1462 | } | ||
1463 | DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime); | ||
1451 | } | 1464 | } |
1452 | 1465 | ||
1453 | function isUsingOwnEntropy() { | 1466 | function isUsingOwnEntropy() { |