Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: EdwardSlo on July 26, 2016, 07:32:42 PM



Title: Creating Private Keys
Post by: EdwardSlo on July 26, 2016, 07:32:42 PM
i was trying to create an program in the c++ that randomly generates private keys like offlinebitcoins.com does
I want to base it off the users input so they input their secret exponent like 1 and generate the public and private key (public) 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf (private) 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm

#include <openssl/sha256.h>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
static const char base58char[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";

int stringLength = sizeof(base58char) - 1;

char KeyGen() 
{

   return base58char[rand() % stringLength];
}

void KeyGeneration()
{
   for (int s = 0; s < 64; s++)
   {
      cout << KeyGen();
   }
   std::cin.get();
}


can anybody help

this has to be all offline


Title: Re: Creating Private Keys
Post by: OgNasty on July 26, 2016, 07:46:00 PM
There's a program called vanitygen that will let you create as many private keys as you want with parameters.  That might help you?

Here's the thread for it.  I highly recommend.

https://bitcointalk.org/index.php?topic=25804.0


Title: Re: Creating Private Keys
Post by: DarkStar_ on July 26, 2016, 11:23:39 PM
There's a program called vanitygen that will let you create as many private keys as you want with parameters.  That might help you?

Here's the thread for it.  I highly recommend.

https://bitcointalk.org/index.php?topic=25804.0
He is looking to create brainwallets, not custom vanity addresses. Edward, does it have to be in C++? You could always download a brainwallet script and run it offline. It has the same result as offlinebitcoins.com every time. If your interested, I recommened using this brainwallet source code (https://github.com/brainwalletX/brainwalletX.github.io), which is a branch of the script offlinebitcoins is using. I haven't checked to see if it will steal your keys, so make sure to only use it offline. I don't recommend using brainwallets though, since they can be easily bruteforced if you pick a fairly easy phrase.


Title: Re: Creating Private Keys
Post by: ImHash on July 28, 2016, 12:55:52 AM
and what are you going to do with them? or what good can come out from doing this?