Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Fizpok on June 04, 2013, 08:55:03 AM



Title: Need C/C++ code for brain wallet function: any suggestions?
Post by: Fizpok on June 04, 2013, 08:55:03 AM
Hi,
I am looking for C/C++ code for brain wallet function.

What it should look like:
1. C/C++
2. No dependencies, all code should be in that function or its sub-functions. Alternatively I need a sample project for MSVC 2005 or before (I don't have licence for later versions). The reason is simple: I am not good enough with C++ to handle installation of 10 mutually dependent libraries as it usually happens in Unix :)

What it should do:
Take ASCII text and produce a private key (the 51 char one, starting with "5").

Technically, this functionality is in pywallet, but it uses Python-specific libraries.


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: CIYAM on June 04, 2013, 09:04:16 AM
Although it's not hard to find direct source for things like SHA256 (e.g. https://github.com/ciyam/ciyam/blob/master/src/sha256.cpp), and base58 could perhaps be taken from Bitcoin itself (https://github.com/bitcoin/bitcoin/blob/master/src/base58.h), it is going to be a bit more difficult to get the ECDSA stuff working if you are not wanting to use *any* 3rd party libraries.

It's not really that difficult to get OpenSSL integrated (CIYAM Open uses it) so if you don't mind using just the *one* 3rd party library then I would recommend using it to help you to complete your project.


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: DannyHamilton on June 04, 2013, 09:09:44 AM
Hi,
I am looking for C/C++ code for brain wallet function.

What it should do:
Take ASCII text and produce a private key (the 51 char one, starting with "5").

it is going to be a bit more difficult to get the ECDSA stuff working if you are not wanting to use *any* 3rd party libraries.

So the important question is:

Do you just want to generate a private key based on the user chosen text, or do you want the software to also output the bitcoin address?

Generating private key only won't be too bad, but you should really consider using OpenSSL if you want your brain wallet generator to compute the bitcoin address as well.


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: Fizpok on June 04, 2013, 09:24:03 AM
I want the string, that importprivkey will be able to use :)


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: Fizpok on June 04, 2013, 09:30:41 AM
Although it's not hard to find direct source for things like SHA256 (e.g. https://github.com/ciyam/ciyam/blob/master/src/sha256.cpp), and base58 could perhaps be taken from Bitcoin itself (https://github.com/bitcoin/bitcoin/blob/master/src/base58.h), it is going to be a bit more difficult to get the ECDSA stuff working if you are not wanting to use *any* 3rd party libraries.

It's not really that difficult to get OpenSSL integrated (CIYAM Open uses it) so if you don't mind using just the *one* 3rd party library then I would recommend using it to help you to complete your project.


That's why I asked for a sample project, not just a code snippet... It is a large and complex library, and I don't need 99% of it...


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: CIYAM on June 04, 2013, 09:34:23 AM
That's why I asked for a sample project, not just a code snippet... It is a large and complex library, and I don't need 99% of it...

A sample project that does what (if there were one that did what you are asking for then you wouldn't be *needing* anything at all)?


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: genjix on June 04, 2013, 09:42:44 AM
http://libbitcoin.dyne.org/doc/crypto.html#deterministic-wallets

Python bindings too (see main page).


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: Fizpok on June 04, 2013, 09:52:17 AM
That's why I asked for a sample project, not just a code snippet... It is a large and complex library, and I don't need 99% of it...

A sample project that does what (if there were one that did what you are asking for then you wouldn't be *needing* anything at all)?


Oh, that's os true!

But htanks for the CYAM, I will try to study it.


Title: Re: Need C/C++ code for brain wallet function: any suggestions?
Post by: Fizpok on June 04, 2013, 09:54:48 AM
http://libbitcoin.dyne.org/doc/crypto.html#deterministic-wallets

Python bindings too (see main page).

Thanks!