diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/css/app.css | 4 | ||||
-rw-r--r-- | src/index.html | 1 | ||||
-rw-r--r-- | src/js/index.js | 13 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/css/app.css b/src/css/app.css index 576b7d7..c2a0294 100644 --- a/src/css/app.css +++ b/src/css/app.css | |||
@@ -31,6 +31,10 @@ body { | |||
31 | .phrase { | 31 | .phrase { |
32 | word-break: keep-all; | 32 | word-break: keep-all; |
33 | } | 33 | } |
34 | .phraseSplitWarn { | ||
35 | text-align: right; | ||
36 | color: red; | ||
37 | } | ||
34 | .generate-container .strength { | 38 | .generate-container .strength { |
35 | /* override mobile width from bootstrap */ | 39 | /* override mobile width from bootstrap */ |
36 | width: auto!important; | 40 | width: auto!important; |
diff --git a/src/index.html b/src/index.html index 8862904..bfb2bc1 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -177,6 +177,7 @@ | |||
177 | <div class="col-sm-10"> | 177 | <div class="col-sm-10"> |
178 | <textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover."></textarea> | 178 | <textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover."></textarea> |
179 | </div> | 179 | </div> |
180 | <div id="phraseSplitWarn" class="phraseSplitWarn"></div> | ||
180 | </div> | 181 | </div> |
181 | <div class="form-group"> | 182 | <div class="form-group"> |
182 | <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> | 183 | <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> |
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() { |