X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=bip39-standalone.html;h=6125ce3d1849bb3c83d42d39ec00d90715817f32;hb=783981debeec37c05173af31588ca5fbc286188c;hp=fffa3556b746edfa094e4def825d282303e52c1d;hpb=d26cce22c18cb0c36b81de43c81f5836fe7459b3;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/bip39-standalone.html b/bip39-standalone.html index fffa355..6125ce3 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html @@ -52,15 +52,15 @@
-

Phrase

+

Mnemonic

-

You can enter an existing BIP39 phrase, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word is a checksum)

+

You can enter an existing BIP39 mnemonic, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word is a checksum)

For more info see the BIP39 spec

- +
@@ -71,7 +71,7 @@
- +
@@ -22432,14 +22432,14 @@ var Mnemonic = function(language) { self.toSeed = function(mnemonic, passphrase) { passphrase = passphrase || ''; - mnemonic = normalizeString(mnemonic) - passphrase = normalizeString(passphrase) + mnemonic = self.normalizeString(mnemonic) + passphrase = self.normalizeString(passphrase) passphrase = "mnemonic" + passphrase; //return PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations=PBKDF2_ROUNDS, macmodule=hmac, digestmodule=hashlib.sha512).read(64) return asmCrypto.PBKDF2_HMAC_SHA512.hex(mnemonic, passphrase, PBKDF2_ROUNDS, 512/8); } - function normalizeString(str) { + self.normalizeString = function(str) { if (typeof str.normalize == "function") { return str.normalize("NFKD"); } @@ -22865,8 +22865,7 @@ WORDLISTS = { function calcBip32Seed(phrase, passphrase, path) { var seed = mnemonic.toSeed(phrase, passphrase); - var seedHash = Bitcoin.crypto.sha256(seed).toString("hex"); - bip32RootKey = Bitcoin.HDNode.fromSeedHex(seedHash, network); + bip32RootKey = Bitcoin.HDNode.fromSeedHex(seed, network); bip32ExtendedKey = bip32RootKey; // Derive the key from the path var pathBits = path.split("/"); @@ -22901,6 +22900,7 @@ WORDLISTS = { function findPhraseErrors(phrase) { // TODO make this right // Preprocess the words + phrase = mnemonic.normalizeString(phrase); var parts = phrase.split(" "); var proper = []; for (var i=0; i