Bitcoin Forum
April 19, 2024, 08:21:25 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 »  All
  Print  
Author Topic: [Bounty - 0.5 BTC ($500)] Javascript / Password Recovery issue (CLAIMED)  (Read 2563 times)
moderate
Member
**
Offline Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 29, 2013, 02:46:10 PM
 #41

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.
1713514885
Hero Member
*
Offline Offline

Posts: 1713514885

View Profile Personal Message (Offline)

Ignore
1713514885
Reply with quote  #2

1713514885
Report to moderator
Bitcoin addresses contain a checksum, so it is very unlikely that mistyping an address will cause you to lose money.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713514885
Hero Member
*
Offline Offline

Posts: 1713514885

View Profile Personal Message (Offline)

Ignore
1713514885
Reply with quote  #2

1713514885
Report to moderator
1713514885
Hero Member
*
Offline Offline

Posts: 1713514885

View Profile Personal Message (Offline)

Ignore
1713514885
Reply with quote  #2

1713514885
Report to moderator
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 29, 2013, 02:51:19 PM
 #42

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?

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
moderate
Member
**
Offline Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 29, 2013, 02:57:06 PM
 #43

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?

Yes, someone did... see http://pastebin.com/mgGitqLr from https://bitcointalk.org/index.php?topic=351547.msg3764612#msg3764612. My initial quote was taken directly from it.

I already contributed proper working code at https://bitcointalk.org/index.php?topic=351547.msg3766027#msg3766027
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
November 29, 2013, 03:02:43 PM
 #44


Well - best of luck with that.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Cyberdyne (OP)
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
November 29, 2013, 03:29:43 PM
 #45


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 Offline

Activity: 36
Merit: 0


View Profile
November 30, 2013, 02:44:41 AM
 #46

Hi Cyberdyne

I have made it so that it shows the progress - http://privatepaste.com/683603b43b

The core of this code is:

Code:
// 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 Offline

Activity: 36
Merit: 0


View Profile
November 30, 2013, 02:56:41 AM
 #47


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)
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
November 30, 2013, 02:58:28 AM
 #48

Hi Cyberdyne

I have made it so that it shows the progress - http://privatepaste.com/683603b43b

The core of this code is:

Code:
// 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)
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
November 30, 2013, 03:00:48 AM
 #49


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:

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstua
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstub
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuc

...

It should stop processing when it reaches the correct one (22nd attempt):

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv  -> This creates the bitcoin address 1KVGuANp3HyH4m6xQYhUV9EWhq6tUVypAG

even though there are 4 more combos...

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuw
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstux
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuy
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuz
moderate
Member
**
Offline Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 30, 2013, 03:04:01 AM
 #50


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)
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
November 30, 2013, 03:05:39 AM
 #51


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 Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 30, 2013, 03:07:14 AM
 #52


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 Offline

Activity: 36
Merit: 0


View Profile
November 30, 2013, 03:12:19 AM
Last edit: November 30, 2013, 03:28:03 AM by schalk
 #53

Sorry, this should fix the issue - http://privatepaste.com/42e170b0cb

Please 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 Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 30, 2013, 03:32:32 AM
 #54


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)
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
November 30, 2013, 03:44:50 AM
 #55


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 Offline

Activity: 36
Merit: 0


View Profile
November 30, 2013, 03:49:07 AM
 #56

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 Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 30, 2013, 03:52:14 AM
 #57

I decline my tip, give it to someone else that needs.
Cyberdyne (OP)
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
November 30, 2013, 03:58:30 AM
 #58

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 Cheesy
moderate
Member
**
Offline Offline

Activity: 98
Merit: 10

nearly dead


View Profile
November 30, 2013, 04:00:18 AM
 #59

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 Cheesy


If you're serious into it, you shouldn't be doing this in javascript.
Cyberdyne (OP)
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
November 30, 2013, 04:03:25 AM
 #60

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 Cheesy


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.
Pages: « 1 2 [3] 4 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!