From 5cdbe4620afc227de81ebbca2443db5350567bee Mon Sep 17 00:00:00 2001 From: Matthew Cornelisse Date: Wed, 28 Nov 2018 01:12:29 -0600 Subject: [PATCH] added code to calculate hack time of split cards --- src/js/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 @@ 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"); @@ -1276,6 +1277,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() { -- 2.41.0