diff options
-rw-r--r-- | bip39-standalone.html | 4 | ||||
-rw-r--r-- | src/js/index.js | 4 | ||||
-rw-r--r-- | tests.js | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index 0d1d244..de74d80 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -41770,7 +41770,9 @@ window.Entropy = new (function() { | |||
41770 | var privKeyBuffer = key.privKey.d.toBuffer(); | 41770 | var privKeyBuffer = key.privKey.d.toBuffer(); |
41771 | privkey = privKeyBuffer.toString('hex'); | 41771 | privkey = privKeyBuffer.toString('hex'); |
41772 | var addressBuffer = ethUtil.privateToAddress(privKeyBuffer); | 41772 | var addressBuffer = ethUtil.privateToAddress(privKeyBuffer); |
41773 | address = "0x" + addressBuffer.toString('hex'); | 41773 | var hexAddress = addressBuffer.toString('hex'); |
41774 | var checksumAddress = ethUtil.toChecksumAddress(hexAddress); | ||
41775 | address = ethUtil.addHexPrefix(checksumAddress); | ||
41774 | } | 41776 | } |
41775 | addAddressToList(indexText, address, pubkey, privkey); | 41777 | addAddressToList(indexText, address, pubkey, privkey); |
41776 | }, 50) | 41778 | }, 50) |
diff --git a/src/js/index.js b/src/js/index.js index 41f8260..4c947a4 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -569,7 +569,9 @@ | |||
569 | var privKeyBuffer = key.privKey.d.toBuffer(); | 569 | var privKeyBuffer = key.privKey.d.toBuffer(); |
570 | privkey = privKeyBuffer.toString('hex'); | 570 | privkey = privKeyBuffer.toString('hex'); |
571 | var addressBuffer = ethUtil.privateToAddress(privKeyBuffer); | 571 | var addressBuffer = ethUtil.privateToAddress(privKeyBuffer); |
572 | address = "0x" + addressBuffer.toString('hex'); | 572 | var hexAddress = addressBuffer.toString('hex'); |
573 | var checksumAddress = ethUtil.toChecksumAddress(hexAddress); | ||
574 | address = ethUtil.addHexPrefix(checksumAddress); | ||
573 | } | 575 | } |
574 | addAddressToList(indexText, address, pubkey, privkey); | 576 | addAddressToList(indexText, address, pubkey, privkey); |
575 | }, 50) | 577 | }, 50) |
@@ -624,12 +624,12 @@ page.open(url, function(status) { | |||
624 | // check the address is generated correctly | 624 | // check the address is generated correctly |
625 | // this value comes from | 625 | // this value comes from |
626 | // https://www.myetherwallet.com/#view-wallet-info | 626 | // https://www.myetherwallet.com/#view-wallet-info |
627 | // I do not understand the capitalization scheme for this hex encoding | 627 | // Unusual capitalization is due to checksum |
628 | var expected = "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772"; | 628 | var expected = "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772"; |
629 | var actual = page.evaluate(function() { | 629 | var actual = page.evaluate(function() { |
630 | return $(".address:first").text(); | 630 | return $(".address:first").text(); |
631 | }); | 631 | }); |
632 | if (actual != expected.toLowerCase()) { | 632 | if (actual != expected) { |
633 | console.log("Ethereum address is incorrect"); | 633 | console.log("Ethereum address is incorrect"); |
634 | console.log("Expected: " + expected); | 634 | console.log("Expected: " + expected); |
635 | console.log("Actual: " + actual); | 635 | console.log("Actual: " + actual); |