aboutsummaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authoriancoleman <1281387+iancoleman@users.noreply.github.com>2019-11-11 09:34:37 +1100
committerGitHub <noreply@github.com>2019-11-11 09:34:37 +1100
commit7cfd04e318155a9a69906436b63a529aa768654f (patch)
treecd1e6852a619b7a04f9798b235cf8662c9f257a8 /src/js
parentd0428a8d211dd5914c4c8547c69c75aca4cccfd6 (diff)
parent5cdbe4620afc227de81ebbca2443db5350567bee (diff)
downloadBIP39-7cfd04e318155a9a69906436b63a529aa768654f.tar.gz
BIP39-7cfd04e318155a9a69906436b63a529aa768654f.tar.zst
BIP39-7cfd04e318155a9a69906436b63a529aa768654f.zip
Merge pull request #280 from mctrivia/add-hack-time-for-split-cards
Add hack time calculation for Split Mnemonic Cards
Diffstat (limited to 'src/js')
-rw-r--r--src/js/index.js13
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() {