moderate
Member
Offline
Activity: 98
Merit: 10
nearly dead
|
|
November 29, 2013, 02:46:10 PM |
|
Since some posts ago I'm not counting on the reward here, just tried to make a point about the code quality.
And as I already pointed out your comment about the "code quality" was completely unnecessary as the OP had already admitted his code was bad and needed re-doing. This is taking so long to settle, maybe we should do it somewhere else. The code quality I'm referring, if it is not clear from the collection of earlier replies, is about the non-working-code that blindly followed the OP code.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
November 29, 2013, 02:51:19 PM |
|
No-one posted code that included the OP code so your "blindly following" comment makes little sense.
If you are keen to contribute then how about just focus on the solution?
|
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
November 29, 2013, 03:02:43 PM |
|
Well - best of luck with that.
|
|
|
|
Cyberdyne (OP)
|
|
November 29, 2013, 03:29:43 PM |
|
Well - best of luck with that. I'm just going to wait for tubbyjr to take a nap and get back to me. His copy is 90% of the way there.
|
|
|
|
schalk
Newbie
Offline
Activity: 36
Merit: 0
|
|
November 30, 2013, 02:44:41 AM |
|
Hi Cyberdyne I have made it so that it shows the progress - http://privatepaste.com/683603b43bThe core of this code is: // we want to find the passcode for this bitcoin address var target = document.getElementById("targetaddress").value.toString().replace(/^\s+|\s+$/g, ""); //var target = "1Eq8Ucu2ugn4owQZ8RUybrA3Cm2Bo7Zzac";
// passphrase search data var inputElements = document.getElementsByTagName("input"); var searchData = []; for(var i = 0; i < inputElements.length; i++) { if (inputElements[i].getAttribute("data-role") == "passPhraseChar") { var value = inputElements[i].value.toString().replace(/^\s+|\s+$/g, ""); if (value != "") { searchData.push(value); } } } //var searchData = ["a", "pP", "pP", "l", "e"];
// we will use a pubKeyHash for comparing when generating an address (this saves the step of base58 encoding when generating an address) // decode address to base58 and extract just the pubKeyHash (so remove the first number and checksum at the end of the address) var targetPubKeyHash = Bitcoin.Base58.decode(target); targetPubKeyHash = targetPubKeyHash.splice(1, targetPubKeyHash.length - 5);
// calculate total combinations var totalCombinations = 0; var totalIterations = 0; var divisors = new Array(); divisors[0] = 1; for(var i = 0; i < searchData.length; i++) { if (i === 0) { totalCombinations = searchData[i].length; totalIterations = totalCombinations; } else { totalCombinations = totalCombinations * searchData[i].length; totalIterations += totalCombinations; } divisors[i + 1] = totalCombinations; }
var amountOfTimesToUpdate = 1000; var updateIncrements = totalCombinations / amountOfTimesToUpdate; var nextUpdate = updateIncrements;
var i = 0; (function asyncBitcoinAddressCheck() {
var checkphrase = ""; for(var n = 0; n < searchData.length; n++) { var index = Math.floor(i / divisors[n]) % searchData[n].length; checkphrase += searchData[n][index]; } var bytes = Crypto.SHA256(checkphrase, { asBytes: true }); var btcKey = new Bitcoin.ECKey(bytes); var pubKeyHash = btcKey.getPubKeyHash(); var found = true; for(var j = 0; j < pubKeyHash.length; j++) { if (pubKeyHash[j] != targetPubKeyHash[j]) { found = false; } } if (found) { var privWif = btcKey.getBitcoinWalletImportFormat(); var bitcoinAddress = btcKey.getBitcoinAddress(); document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress; document.getElementById("brainbtcprivwif").innerHTML = privWif; ninja.qrCode.showQrCode({ "brainqrcodepublic": bitcoinAddress, "brainqrcodeprivate": privWif }); document.getElementById("brainkeyarea").style.visibility = "visible"; alert("Password is " + checkphrase); return; } if (i < totalCombinations) { i++; if (i > nextUpdate) { nextUpdate += updateIncrements; document.getElementById("bulktextarea2").value = "Checking combination " + (i + 1) + " out of " + totalCombinations + " (" + (Math.round( i / totalCombinations * 1000 ) / 10) + "%)"; setTimeout(asyncBitcoinAddressCheck, 0); } else { asyncBitcoinAddressCheck(); } } })();
document.getElementById("bulktextarea2").value = "Checking combination " + totalCombinations + " out of " + totalCombinations + " (100%)"; Regards Schalk
|
|
|
|
schalk
Newbie
Offline
Activity: 36
Merit: 0
|
|
November 30, 2013, 02:56:41 AM |
|
Hi Tubby, Your progress alert is working how I'd expect, however your code doesn't seem to be actually checking each address against the target. Once the target address is found, it should stop processing and show what phrase generated that address. I tried your code with the following phrase: abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv The real bitaddress.org says the address for that is 1KVGuANp3HyH4m6xQYhUV9EWhq6tUVypAG So, in your html, I input: a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u abcdefghijklmnopqrstuvwxyz 1KVGuANp3HyH4m6xQYhUV9EWhq6tUVypAG There are 26 combinations in the above, but your code tries all 26 of them with no 'success', whereas it should have found success on the 23rd 22nd attempt. My originally supplied code in the OP does properly check the target address and stop processing at that point, so this is functionality that you have broken or removed in your version. If you can put that functionality back in, the bounty would be yours. Thanks very much. Isn't this the unexpected result? Shouldn't it just check: abcdefghijklmnopqrstua abcdefghijklmnopqrstub abcdefghijklmnopqrstuc ,,, abcdefghijklmnopqrstuz so it will never check abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv?
|
|
|
|
Cyberdyne (OP)
|
|
November 30, 2013, 02:58:28 AM |
|
Hi Cyberdyne I have made it so that it shows the progress - http://privatepaste.com/683603b43bThe core of this code is: // we want to find the passcode for this bitcoin address var target = document.getElementById("targetaddress").value.toString().replace(/^\s+|\s+$/g, ""); //var target = "1Eq8Ucu2ugn4owQZ8RUybrA3Cm2Bo7Zzac";
// passphrase search data var inputElements = document.getElementsByTagName("input"); var searchData = []; for(var i = 0; i < inputElements.length; i++) { if (inputElements[i].getAttribute("data-role") == "passPhraseChar") { var value = inputElements[i].value.toString().replace(/^\s+|\s+$/g, ""); if (value != "") { searchData.push(value); } } } //var searchData = ["a", "pP", "pP", "l", "e"];
// we will use a pubKeyHash for comparing when generating an address (this saves the step of base58 encoding when generating an address) // decode address to base58 and extract just the pubKeyHash (so remove the first number and checksum at the end of the address) var targetPubKeyHash = Bitcoin.Base58.decode(target); targetPubKeyHash = targetPubKeyHash.splice(1, targetPubKeyHash.length - 5);
// calculate total combinations var totalCombinations = 0; var totalIterations = 0; var divisors = new Array(); divisors[0] = 1; for(var i = 0; i < searchData.length; i++) { if (i === 0) { totalCombinations = searchData[i].length; totalIterations = totalCombinations; } else { totalCombinations = totalCombinations * searchData[i].length; totalIterations += totalCombinations; } divisors[i + 1] = totalCombinations; }
var amountOfTimesToUpdate = 1000; var updateIncrements = totalCombinations / amountOfTimesToUpdate; var nextUpdate = updateIncrements;
var i = 0; (function asyncBitcoinAddressCheck() {
var checkphrase = ""; for(var n = 0; n < searchData.length; n++) { var index = Math.floor(i / divisors[n]) % searchData[n].length; checkphrase += searchData[n][index]; } var bytes = Crypto.SHA256(checkphrase, { asBytes: true }); var btcKey = new Bitcoin.ECKey(bytes); var pubKeyHash = btcKey.getPubKeyHash(); var found = true; for(var j = 0; j < pubKeyHash.length; j++) { if (pubKeyHash[j] != targetPubKeyHash[j]) { found = false; } } if (found) { var privWif = btcKey.getBitcoinWalletImportFormat(); var bitcoinAddress = btcKey.getBitcoinAddress(); document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress; document.getElementById("brainbtcprivwif").innerHTML = privWif; ninja.qrCode.showQrCode({ "brainqrcodepublic": bitcoinAddress, "brainqrcodeprivate": privWif }); document.getElementById("brainkeyarea").style.visibility = "visible"; alert("Password is " + checkphrase); return; } if (i < totalCombinations) { i++; if (i > nextUpdate) { nextUpdate += updateIncrements; document.getElementById("bulktextarea2").value = "Checking combination " + (i + 1) + " out of " + totalCombinations + " (" + (Math.round( i / totalCombinations * 1000 ) / 10) + "%)"; setTimeout(asyncBitcoinAddressCheck, 0); } else { asyncBitcoinAddressCheck(); } } })();
document.getElementById("bulktextarea2").value = "Checking combination " + totalCombinations + " out of " + totalCombinations + " (100%)"; Regards Schalk Hi Schalk, this worked properly when I fed it something with 2^11 (2048) combos, but hung the browser when i tried 2^23 (8m). It just sits there not responding after clicking [view], and then finally I get a popup telling me it's not responding and would I like to kill it. On the other hand tubby's handles massive numbers, but doesn't yet spit out the successful phrase. Seems like with yours and his powers combined we're so close to having something here.
|
|
|
|
Cyberdyne (OP)
|
|
November 30, 2013, 03:00:48 AM |
|
Hi Tubby, Your progress alert is working how I'd expect, however your code doesn't seem to be actually checking each address against the target. Once the target address is found, it should stop processing and show what phrase generated that address. I tried your code with the following phrase: abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv The real bitaddress.org says the address for that is 1KVGuANp3HyH4m6xQYhUV9EWhq6tUVypAG So, in your html, I input: a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u abcdefghijklmnopqrstuvwxyz 1KVGuANp3HyH4m6xQYhUV9EWhq6tUVypAG There are 26 combinations in the above, but your code tries all 26 of them with no 'success', whereas it should have found success on the 23rd 22nd attempt. My originally supplied code in the OP does properly check the target address and stop processing at that point, so this is functionality that you have broken or removed in your version. If you can put that functionality back in, the bounty would be yours. Thanks very much. Isn't this the unexpected result? Shouldn't it just check: abcdefghijklmnopqrstua abcdefghijklmnopqrstub abcdefghijklmnopqrstuc ,,, abcdefghijklmnopqrstuz so it will never check abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv? No, the pass is always 48 chars long (That's what the 48 input boxes are for). It'll check: abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu aabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu babcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu c... It should stop processing when it reaches the correct one (22nd attempt): abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu v -> This creates the bitcoin address 1KVGuANp3HyH4m6xQYhUV9EWhq6tUVypAG even though there are 4 more combos... abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu wabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu xabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu yabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu z
|
|
|
|
moderate
Member
Offline
Activity: 98
Merit: 10
nearly dead
|
|
November 30, 2013, 03:04:01 AM |
|
this worked properly when I fed it something with 2^11 (2048) combos, but hung the browser when i tried 2^23 (8m).
It just sits there not responding after clicking [view], and then finally I get a popup telling me it's not responding and would I like to kill it.
I know you hate me and all for whatever reason, but if you tried running the earlier code I gave you will notice it can handle 2^23 and other inputs without killing the browser. Obviously it will take a long time because generating addresses in javascript is slow.
|
|
|
|
Cyberdyne (OP)
|
|
November 30, 2013, 03:05:39 AM |
|
this worked properly when I fed it something with 2^11 (2048) combos, but hung the browser when i tried 2^23 (8m).
It just sits there not responding after clicking [view], and then finally I get a popup telling me it's not responding and would I like to kill it.
I know you hate me and all for whatever reason, but if you tried running the earlier code I gave you will notice it can handle 2^23 and other inputs without killing the browser. Obviously it will take a long time because generating addresses in javascript is slow. I don't hate people who haven't matured yet. I've been there before, myself. I will take a look at your code now and give praise where praise is due. Thanks.
|
|
|
|
moderate
Member
Offline
Activity: 98
Merit: 10
nearly dead
|
|
November 30, 2013, 03:07:14 AM |
|
this worked properly when I fed it something with 2^11 (2048) combos, but hung the browser when i tried 2^23 (8m).
It just sits there not responding after clicking [view], and then finally I get a popup telling me it's not responding and would I like to kill it.
I know you hate me and all for whatever reason, but if you tried running the earlier code I gave you will notice it can handle 2^23 and other inputs without killing the browser. Obviously it will take a long time because generating addresses in javascript is slow. I don't hate people who haven't matured yet. I've been there before, myself. I will take a look at your code now and give praise where praise is due. Thanks. Thanks for at least taking a look at it. With your earlier example, it stops at (abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv) Combinations tried: 22 out of 26 and shows the match, btw.
|
|
|
|
schalk
Newbie
Offline
Activity: 36
Merit: 0
|
|
November 30, 2013, 03:12:19 AM Last edit: November 30, 2013, 03:28:03 AM by schalk |
|
Sorry, this should fix the issue - http://privatepaste.com/42e170b0cbPlease note when I recoded it I made sure to make sure it performs fast. As you'll notice with large combinations (like 10,000,000 mine will perform around 5 times faster than moderate's solution on chrome on my computer). I tested it and it should take 41.67 hours to solve 8,000,000 combinations (on my computer).
|
|
|
|
moderate
Member
Offline
Activity: 98
Merit: 10
nearly dead
|
|
November 30, 2013, 03:32:32 AM |
|
note when I recoded it I made sure to make sure it performs fast. As you'll notice with large combinations (like 10,000,000 mine will perform around 5 times faster than moderate's solution on chrome on my computer).
Is the benchmark available somewhere ? Which line(s) make it faster/slower ? EDIT: Nevermind, I see you just did a setTimeout(asyncBitcoinAddressCheck, 0). I guess you didn't see the default timeout at my code is 100 ms ? That's what make it not kill the browser.
|
|
|
|
Cyberdyne (OP)
|
|
November 30, 2013, 03:44:50 AM |
|
this worked properly when I fed it something with 2^11 (2048) combos, but hung the browser when i tried 2^23 (8m).
It just sits there not responding after clicking [view], and then finally I get a popup telling me it's not responding and would I like to kill it.
I know you hate me and all for whatever reason, but if you tried running the earlier code I gave you will notice it can handle 2^23 and other inputs without killing the browser. Obviously it will take a long time because generating addresses in javascript is slow. I don't hate people who haven't matured yet. I've been there before, myself. I will take a look at your code now and give praise where praise is due. Thanks. Thanks for at least taking a look at it. With your earlier example, it stops at (abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv) Combinations tried: 22 out of 26 and shows the match, btw. Well this does work as described thanks, although I won't be using it as it's 20x slower than tubby's. Anyway, I've actually done the last little bit of tubby's code myself, so I have everything I need now. Thanks everyone for your efforts and participation, I'm sending out coins like this: The code I'll be actually using (with my own tiny mod): Tubbyjr: 0.4 BTC Had a good crack at this, but ultimately I won't be using his code: Schalk: 0.1 BTC Tips (Let me know your address if you haven't already): KieranJones1: 0.005 BTC Ciyam: 0.005 BTC Moderate: 0.005 BTC - Try not to come off so harsh next time, and your coding will take you far, I'm sure.
|
|
|
|
schalk
Newbie
Offline
Activity: 36
Merit: 0
|
|
November 30, 2013, 03:49:07 AM |
|
No, that isn't necessary. If we were updating the DOM constantly then yes maybe 0 might make it crash. But mine doesn't update the DOM constantly. I've been running mine for 75685 combinations so far and it's still going smoothly.
For performance I also compare the PubKeyHash instead of the actual bitcoin address (won't make a hell of a lot of difference, but every little bit helps).
EDIT: Alright - thanks for the tip!
|
|
|
|
moderate
Member
Offline
Activity: 98
Merit: 10
nearly dead
|
|
November 30, 2013, 03:52:14 AM |
|
I decline my tip, give it to someone else that needs.
|
|
|
|
Cyberdyne (OP)
|
|
November 30, 2013, 03:58:30 AM |
|
I decline my tip, give it to someone else that needs.
Sure thing - I'll need it myself if I don't end up cracking this damn password
|
|
|
|
moderate
Member
Offline
Activity: 98
Merit: 10
nearly dead
|
|
November 30, 2013, 04:00:18 AM |
|
I decline my tip, give it to someone else that needs.
Sure thing - I'll need it myself if I don't end up cracking this damn password If you're serious into it, you shouldn't be doing this in javascript.
|
|
|
|
Cyberdyne (OP)
|
|
November 30, 2013, 04:03:25 AM |
|
I decline my tip, give it to someone else that needs.
Sure thing - I'll need it myself if I don't end up cracking this damn password If you're serious into it, you shouldn't be doing this in javascript. Thanks, I'll get serious if 8m doesn't yield a result. At that point I'll post a new bounty for some hardcore gpu coding and test a few trillion.
|
|
|
|
|