Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: JetRX on August 13, 2015, 07:32:52 AM



Title: Need brainwallet php script
Post by: JetRX on August 13, 2015, 07:32:52 AM
I need to get out of my Passphrase:
1. Private Key
2. Address

There is a script for php?


Title: Re: Need brainwallet php script
Post by: Kazimir on August 13, 2015, 11:37:31 AM
Are you sure you would prefer a typical server-side solution (php) for something that can also be done client-side (javascript) ?

BitcoinJs (http://bitcoinjs.org/) works well for this, and allows you to do it completely locally & offline.


Title: Re: Need brainwallet php script
Post by: coinableS on August 13, 2015, 11:41:52 AM
Are you sure you would prefer a typical server-side solution (php) for something that can also be done client-side (javascript) ?

BitcoinJs (http://bitcoinjs.org/) works well for this, and allows you to do it completely locally & offline.

Agreed, why does it have to be PHP?
You can get the JS brainwallet code as it is still available on github from previous commits.
https://github.com/brainwallet/brainwallet.github.io/commit/fa462be9af74da30ae7e78203c11b94a0f887539


Title: Re: Need brainwallet php script
Post by: fbueller on August 13, 2015, 12:36:29 PM
JetRX: Depending on what passphrase you mean, try out https://github.com/Bit-Wasp/bitcoin-php. It's in composer too.

Some of the examples may be out of date, but an IDE will have you coding in no time.



Kazimir: Do you use electrum? That's python.. but on the client-side.


Title: Re: Need brainwallet php script
Post by: AccountStore.biz on August 13, 2015, 03:12:34 PM
Important detail: what website/tool did you use to create the brainwallet? if it was brainwallet.org, use the github link posted above. The problem is there is no standardization for brainwallets, each tool works differently, some tools will give a different address + private key for the same brainwallet phrase.


Title: Re: Need brainwallet php script
Post by: Kazimir on August 13, 2015, 07:39:15 PM
By far the most common is to use this as your brainwallet:

private key = Sha256(passphrase)

This is also what brainwallet.org did.


Title: Re: Need brainwallet php script
Post by: hexafraction on August 13, 2015, 10:27:14 PM
By far the most common is to use this as your brainwallet:

private key = Sha256(passphrase)

This is also what brainwallet.org did.

That's insecure. For new brainwallet applications:

1) Consider if a brainwallet is truly necessary. If not, use more secure means. If it is, go to step 2.
2) Use a "slower" key stretching function with multiple rounds (to prevent brute force attacks), and use a long and secure passphrase.


Title: Re: Need brainwallet php script
Post by: coinableS on August 13, 2015, 10:28:08 PM
By far the most common is to use this as your brainwallet:

private key = Sha256(passphrase)

This is also what brainwallet.org did.

I think it would be worth noting that simply a sha256 hash of a passphrase or word will not produce a user-friendly bitcoin private key, it would have to then be converted to WIF.

http://bitcoin.stackexchange.com/questions/8247/how-can-i-convert-a-sha256-hash-into-a-bitcoin-base58-private-key



Title: Re: Need brainwallet php script
Post by: tspacepilot on August 14, 2015, 09:10:42 AM
Are you sure you would prefer a typical server-side solution (php) for something that can also be done client-side (javascript) ?

BitcoinJs (http://bitcoinjs.org/) works well for this, and allows you to do it completely locally & offline.

I almost never use php myself, I'm more of a python/javascript/perl/bash person, but I just have to point out for the record that you can run php in a terminal as a simple executable.  Just put it on your $PATH and call "php" with your php file as the first argument.  Say this is your file hello.php:

Code:
<?php
  
echo "hello, world";
?>


Code:
$ php hello.php
hello, world
$

@OP, I hope anyone playing with brainwallets knows about this:
http://www.wired.com/2015/07/brainflayer-password-cracker-steals-bitcoins-brain/