Last active
August 29, 2015 13:57
-
-
Save ohac/9598132 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "key.h" | |
#include "base58.h" | |
#undef printf | |
#define printf printf | |
bool fTestNet = false; | |
// usage: g++ keygen.cpp key.cpp -lcrypto -lboost_system && ./a.out | |
LockedPageManager LockedPageManager::instance; | |
int main(int argc, char** argv) | |
{ | |
CKey mykey; | |
mykey.MakeNewKey(true); | |
CPubKey pubkey = mykey.GetPubKey(); | |
const unsigned char *p = pubkey.begin(); | |
unsigned int size = pubkey.size(); | |
puts("pubkey:"); | |
for (int i = 0; i < size; i++) { | |
printf("%02x", p[i]); | |
} | |
puts("\n"); | |
p = mykey.begin(); | |
size = mykey.size(); | |
puts("privkey:"); | |
for (int i = 0; i < size; i++) { | |
printf("%02x", p[i]); | |
} | |
puts("\n"); | |
CBitcoinAddress btcaddr; | |
btcaddr.Set(pubkey.GetID()); | |
printf("%s\n", btcaddr.ToString().c_str()); | |
CBitcoinSecret btcsecret; | |
btcsecret.SetKey(mykey); | |
printf("%s\n", btcsecret.ToString().c_str()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment