Post
Topic
Board Development & Technical Discussion
Re: Brain Wallet for BIP39
by
miky55
on 05/05/2020, 02:46:14 UTC
You can then take each grouping of 11, convert it back in to decimal, and map it the relevant BIP39 word. 00110000111 in decimal is 391, which maps to "couch" at position 392 on the BIP39 word list (remembering to add one since your converted numbers will start at 0, whereas the word list starts at 1). 10000101100 in decimal is 1068, which maps to "machine" at position 1069. And so on.

Thank you this was very helpful, I added an iteration field which will loop sha256 before generating the mnemonic to discourage bruteforce attack, in my browser  1000000 will take approx 20 seconds to compute.

Code:
    var hash = sjcl.hash.sha256.hash(DOM.longpassphrase.val());
    var hex = sjcl.codec.hex.fromBits(hash);
        for (var i = 0; i < DOM.iterations.val() - 1; i++) {
            var hash = sjcl.hash.sha256.hash(hex);
            var hex = sjcl.codec.hex.fromBits(hash);
        }
    DOM.entropy.val(hex);
    setMnemonicFromEntropy();