From b1100c66eb9d3f71b350ec218d61c15951d578a9 Mon Sep 17 00:00:00 2001 From: Matthew Cornelisse Date: Tue, 20 Nov 2018 02:23:19 -0600 Subject: Added 2/3 Seed Card --- src/index.html | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/index.html b/src/index.html index 36d753b..1d67340 100644 --- a/src/index.html +++ b/src/index.html @@ -172,6 +172,12 @@ +
+ +
+ +
+
-- cgit v1.2.3 From 97bde20b849aca29056b1229e4ca0dbab832bf0b Mon Sep 17 00:00:00 2001 From: Matthew Cornelisse Date: Tue, 20 Nov 2018 02:23:51 -0600 Subject: Added 2/3 Seed Card --- src/js/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src') diff --git a/src/js/index.js b/src/js/index.js index de509e8..a778799 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -44,6 +44,7 @@ DOM.entropyWeakEntropyOverrideWarning = DOM.entropyContainer.find(".weak-entropy-override-warning"); DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning"); DOM.phrase = $(".phrase"); + DOM.splitPhrase = $(".phraseSplit"); DOM.passphrase = $(".passphrase"); DOM.generateContainer = $(".generate-container"); DOM.generate = $(".generate"); @@ -297,6 +298,7 @@ clearDisplay(); clearEntropyFeedback(); DOM.phrase.val(""); + DOM.phraseSplit.val(""); showValidationError("Blank entropy"); return; } @@ -331,6 +333,7 @@ showPending(); // Clear existing mnemonic and passphrase DOM.phrase.val(""); + DOM.phraseSplit.val(""); DOM.passphrase.val(""); seed = null; if (rootKeyChangedTimeoutEvent != null) { @@ -417,6 +420,7 @@ if (DOM.phrase.val().length > 0) { var newPhrase = convertPhraseToNewLanguage(); DOM.phrase.val(newPhrase); + writeSplitPhrase(newPhrase); phraseChanged(); } else { @@ -477,6 +481,7 @@ // show the words var words = mnemonic.toMnemonic(data); DOM.phrase.val(words); + writeSplitPhrase(words); // show the entropy var entropyHex = uint8ArrayToHex(data); DOM.entropy.val(entropyHex); @@ -1250,6 +1255,28 @@ } return phrase; } + + function writeSplitPhrase(phrase) { + var wordCount = phrase.split(/\s/g).length; //get number of words in phrase + var left=[]; //initialize array of indexs + for (var i=0;i0) { //while indexs left + groupI=(groupI+1)%3; //get next group to insert index into + seed = seed * 16807 % 2147483647; //change random value.(simple predicatable random number generator works well for this use) + var selected=Math.floor(left.length*(seed - 1) / 2147483646); //get index in left we will use for this group + group[groupI].push(left[selected]); //add index to group + left.splice(selected,1); //remove selected index + } + var cards=[phrase.split(/\s/g),phrase.split(/\s/g),phrase.split(/\s/g)];//make array of cards + for (var i=0;i<3;i++) { //go through each card + for (var ii=0;ii