diff --git a/src/ninja.vanitywallet.js b/src/ninja.vanitywallet.js index eb6845c..09efe8d 100644 --- a/src/ninja.vanitywallet.js +++ b/src/ninja.vanitywallet.js @@ -29,10 +29,17 @@ ninja.wallets.vanitywallet = { var privateKeyWif = ninja.translator.get("vanityinvalidinputcouldnotcombinekeys"); var bitcoinAddress = ninja.translator.get("vanityinvalidinputcouldnotcombinekeys"); var publicKeyHex = ninja.translator.get("vanityinvalidinputcouldnotcombinekeys"); + var compressedOutput = false; try { var input1KeyString = document.getElementById("vanityinput1").value; var input2KeyString = document.getElementById("vanityinput2").value; + // if any input is in a compressed format, compress the output + compressedOutput = compressedOutput || ninja.publicKey.isCompressedPublicKeyHexFormat(input1KeyString); + compressedOutput = compressedOutput || ninja.publicKey.isCompressedPublicKeyHexFormat(input2KeyString); + compressedOutput = compressedOutput || Bitcoin.ECKey.isCompressedWalletImportFormat(input1KeyString); + compressedOutput = compressedOutput || Bitcoin.ECKey.isCompressedWalletImportFormat(input2KeyString); + // both inputs are public keys if (ninja.publicKey.isPublicKeyHexFormat(input1KeyString) && ninja.publicKey.isPublicKeyHexFormat(input2KeyString)) { // add both public keys together @@ -88,6 +95,7 @@ ninja.wallets.vanitywallet = { alert(ninja.translator.get("vanityalertinvalidinputprivatekeysmatch")); } else { + combinedPrivateKey.compressed = compressedOutput; bitcoinAddress = combinedPrivateKey.getBitcoinAddress(); privateKeyWif = combinedPrivateKey.getBitcoinWalletImportFormat(); publicKeyHex = combinedPrivateKey.getPubKeyHex(); @@ -115,4 +123,4 @@ ninja.wallets.vanitywallet = { document.getElementById("vanitystep" + num + "icon").setAttribute("class", "less"); } } -}; \ No newline at end of file +};