X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=bip39-standalone.html;h=5158b108ebed17ffe074807684de320592685a40;hb=6ea15134a4ff5a443d96de5882bcddbe7300fc6f;hp=0f7d7d08a10bf2759a9683bd2623cf69141908d4;hpb=52da415f0385a6a89070498d14259aed980f989b;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/bip39-standalone.html b/bip39-standalone.html index 0f7d7d0..5158b10 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html @@ -521,6 +521,14 @@ random enough for the needs of this tool.

+

+ Do not store entropy. +

+

+ Storing entropy (such as keeping a deck of cards in a specific shuffled order) is unreliable compared to storing a mnemonic. + Instead of storing entropy, store the mnemonic generated from the entropy. + Steganography may be beneficial when storing the mnemonic. +

The random mnemonic generator on this page uses a @@ -18584,15 +18592,12 @@ window.Entropy = new (function() { // Create a normalized string of the selected cards var normalizedCards = cards.join("").toUpperCase(); // Convert to binary using the SHA256 hash of the normalized cards. - // If the number of bits is more than 256, multiple rounds of hashing + // If the number of bits is more than 256, multiple hashes // are used until the required number of bits is reached. var entropyBin = ""; var iterations = 0; while (entropyBin.length < numberOfBits) { - var hashedCards = sjcl.hash.sha256.hash(normalizedCards); - for (var j=0; j -1; + var isXpubkey = !("privKey" in bip32RootKey); + if (hardened && isXpubkey) { + return "Hardened derivation path is invalid with xpub key"; + } return false; } @@ -19119,7 +19143,11 @@ window.Entropy = new (function() { DOM.seed.val(seed); var rootKey = bip32RootKey.toBase58(); DOM.rootKey.val(rootKey); - var extendedPrivKey = bip32ExtendedKey.toBase58(); + var xprvkeyB58 = "NA"; + if (bip32ExtendedKey.privKey) { + xprvkeyB58 = bip32ExtendedKey.toBase58(); + } + var extendedPrivKey = xprvkeyB58; DOM.extendedPrivKey.val(extendedPrivKey); var extendedPubKey = bip32ExtendedKey.toBase58(false); DOM.extendedPubKey.val(extendedPubKey); @@ -19153,7 +19181,10 @@ window.Entropy = new (function() { key = bip32ExtendedKey.derive(index); } var address = key.getAddress().toString(); - var privkey = key.privKey.toWIF(network); + var privkey = "NA"; + if (key.privKey) { + privkey = key.privKey.toWIF(network); + } var pubkey = key.pubKey.toHex(); var indexText = getDerivationPath() + "/" + index; if (useHardenedAddresses) { @@ -19261,6 +19292,9 @@ window.Entropy = new (function() { var closestWord = words[0]; for (var i=0; i