Merge pull request #280 from mctrivia/add-hack-time-for-split-cards

Add hack time calculation for Split Mnemonic Cards
This commit is contained in:
iancoleman
2019-11-11 09:34:37 +11:00
committed by GitHub
4 changed files with 18 additions and 960 deletions
+4
View File
@@ -31,6 +31,10 @@ body {
.phrase {
word-break: keep-all;
}
.phraseSplitWarn {
text-align: right;
color: red;
}
.generate-container .strength {
/* override mobile width from bootstrap */
width: auto!important;
+1
View File
@@ -177,6 +177,7 @@
<div class="col-sm-10">
<textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover."></textarea>
</div>
<div id="phraseSplitWarn" class="phraseSplitWarn"></div>
</div>
<div class="form-group">
<label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label>
+13
View File
@@ -45,6 +45,7 @@
DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning");
DOM.phrase = $(".phrase");
DOM.splitPhrase = $(".phraseSplit");
DOM.phraseSplitWarn = $(".phraseSplitWarn");
DOM.passphrase = $(".passphrase");
DOM.generateContainer = $(".generate-container");
DOM.generate = $(".generate");
@@ -1448,6 +1449,18 @@
cards[i]='Card '+(i+1)+': '+wordArrayToPhrase(cards[i]); //combine words on card back to string
}
DOM.splitPhrase.val(cards.join("\r\n")); //make words visible
var triesPerSecond=10000000000; //assumed number of tries per second
var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond; //get number of bits of unknown data per card
if (hackTime<1) {
hackTime="<1 second";
} else if (hackTime<86400) {
hackTime=Math.floor(hackTime)+" seconds";
} else if(hackTime<31557600) {
hackTime=Math.floor(hackTime/86400)+" days";
} else {
hackTime=Math.floor(hackTime/31557600)+" years";
}
DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime);
}
function isUsingOwnEntropy() {