aboutsummaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorMatthew Cornelisse <squarerootofnegativeone@gmail.com>2018-11-28 01:12:29 -0600
committerGitHub <noreply@github.com>2018-11-28 01:12:29 -0600
commit5cdbe4620afc227de81ebbca2443db5350567bee (patch)
treeedb1a59c53b85fdcdc2d4f5ae52eac5c3b34ee3d /src/js
parent825332536577a1443daf69e4eaa54279ae2a4285 (diff)
downloadBIP39-5cdbe4620afc227de81ebbca2443db5350567bee.tar.gz
BIP39-5cdbe4620afc227de81ebbca2443db5350567bee.tar.zst
BIP39-5cdbe4620afc227de81ebbca2443db5350567bee.zip
added code to calculate hack time of split 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 a778799..79c3c64 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");
@@ -1276,6 +1277,18 @@
1276 cards[i]='Card '+(i+1)+': '+wordArrayToPhrase(cards[i]); //combine words on card back to string 1277 cards[i]='Card '+(i+1)+': '+wordArrayToPhrase(cards[i]); //combine words on card back to string
1277 } 1278 }
1278 DOM.splitPhrase.val(cards.join("\r\n")); //make words visible 1279 DOM.splitPhrase.val(cards.join("\r\n")); //make words visible
1280 var triesPerSecond=10000000000; //assumed number of tries per second
1281 var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond; //get number of bits of unknown data per card
1282 if (hackTime<1) {
1283 hackTime="<1 second";
1284 } else if (hackTime<86400) {
1285 hackTime=Math.floor(hackTime)+" seconds";
1286 } else if(hackTime<31557600) {
1287 hackTime=Math.floor(hackTime/86400)+" days";
1288 } else {
1289 hackTime=Math.floor(hackTime/31557600)+" years";
1290 }
1291 DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime);
1279 } 1292 }
1280 1293
1281 function isUsingOwnEntropy() { 1294 function isUsingOwnEntropy() {