Giter Site home page Giter Site logo

bitkeygen's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bitkeygen's Issues

error bad public key x/y (leading zeros?)

This is great thanks. I am trying to understand why I am getting x/y with 31 bytes instead of 32? Do we need to pad them?

if ( BN_num_bytes(x) != 32 ) {
// printf ( "error bad public key x (leading zeros?)\n" );
// exit ( 2 );
}
if ( BN_num_bytes(y) != 32 ) {
// printf ( "error bad public key y (leading zeros?)\n" );
// exit ( 2 );
}

build error

gcc -o genkey genkey.c -lm -lcrypto 
genkey.c: In function ‘base58check’:
genkey.c:31:3: warning: implicit declaration of function ‘SHA256’ [-Wimplicit-function-declaration]
   SHA256 ( data, len, sout );
   ^
genkey.c:37:5: warning: implicit declaration of function ‘ERR_print_errors’ [-Wimplicit-function-declaration]
     ERR_print_errors ( stderr );
     ^
genkey.c:51:26: warning: implicit declaration of function ‘ERR_get_error’ [-Wimplicit-function-declaration]
       unsigned long en = ERR_get_error ();
                          ^
genkey.c:52:24: warning: implicit declaration of function ‘ERR_error_string’ [-Wimplicit-function-declaration]
       printf ( "%s\n", ERR_error_string ( en, NULL ) );
                        ^
genkey.c:52:16: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
       printf ( "%s\n", ERR_error_string ( en, NULL ) );
                ^
genkey.c:62:16: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   uint8_t* q = data;
                ^
genkey.c: In function ‘run’:
genkey.c:137:17: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   uint64_t* p = privdata + tp->offset;
                 ^
genkey.c:146:18: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
     char* addr = strdup ( pub );  // pub is in scratch, which is about to be reused
                  ^
genkey.c:146:18: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
genkey.c:161:20: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
       char* addr = strdup ( pub );  // pub is in scratch, which is about to be reused
                    ^
genkey.c: In function ‘checkString58’:
genkey.c:189:19: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   char* invalid = strdup ( in );
                   ^
genkey.c: In function ‘main’:
genkey.c:214:16: warning: implicit declaration of function ‘getopt’ [-Wimplicit-function-declaration]
   while ((ch = getopt(argc, argv, "t:acs:vlh")) != -1) {
                ^
genkey.c:217:27: error: ‘optarg’ undeclared (first use in this function)
       numthreads = atoi ( optarg );
                           ^
genkey.c:217:27: note: each undeclared identifier is reported only once for each function it appears in
genkey.c:273:21: warning: passing argument 2 of ‘pthread_join’ from incompatible pointer type [-Wincompatible-pointer-types]
   pthread_join ( t, &status );
                     ^
In file included from genkey.c:11:0:
/usr/include/pthread.h:250:12: note: expected ‘void **’ but argument is of type ‘int *’
 extern int pthread_join (pthread_t __th, void **__thread_return);
            ^
genkey.c:280:14: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
     printf ( "tried %u\n", cnt );

Add EC_POINT_free in calcECPubkey()

Looks like a nifty tool to generate vanity addresses.

I think in uint8_t* calcECPubkey() there should be an:

if (pubpoint)
       EC_POINT_free(pubpoint);

Speed improvement?

Adding EC_GROUP_precompute_mult appears to improve performance 5x/6x as precomputations are made for the generator point of the curve.

group = EC_GROUP_new_by_curve_name ( NID_secp256k1 );
if (group == NULL ) {
printf ( "error %d\n", LINE );
exit(1);
}
BN_CTX *ctx = BN_CTX_new();
BN_CTX_start( ctx );
EC_GROUP_precompute_mult( group , ctx);

However, adding this and it appears to be generating duplicates, say 10-20 dupes in a set of 5-10 million vanity addresses. Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.