Bitcoin Forum
June 17, 2024, 05:49:54 PM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 [49] 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ... 261 »
  Print  
Author Topic: Bitcoin puzzle transaction ~32 BTC prize to who solves it  (Read 190795 times)
mrxtraf
Member
**
Offline Offline

Activity: 255
Merit: 27


View Profile WWW
June 17, 2019, 12:49:49 AM
 #961

An interesting situation. The numbers 65, 70, 75, 80, 85 were transferred to different multi-addresses 3 ...., and no further movement. If there was one person. That would merge on one address, and probably would use these funds. And so some strange movement.

65 to 3GVSoQar7WnVMFjchpkNkh9UwkJbbdeCwM and stop
70 to 3MpeFYTuwfrxSnUXNmTnY3XTgvhPp5k7vF and stop
75 to 3HrUTaDiyKaGMyVycK8fynRGpAPV64AtV7 and stop
80 to 39vbryGKfcpuch6RLWa97BqG3rKFQQWJh7 and stop
85 to 3Qpip6a2oYgbrcomVpeaUZ4PVXsGVshuec and stop

In BCH
65 to qrvyzatwha3v3rjjtrx52qv8fe9kppcxcsfj2l6u7x and stop
70 to qqhqyz2lk0vg54x496cluhsxllz5kzjx45uy2lk8nj and stop
75 to qpwpa9twauk93ytd9rk6cgnutmgag6jldqfe7rkqy0 and stop
80 to qrwze4p5tg70jm00vvea797czsyhmw87qvwezya0ys and to qpzhkgrq5evgpsqczah9u32f7qx4ggw2ru2wuxj2ra and stop
85 to qz9tf4gmk869jv959lnyuhx5hevuj0kdxq6u8zrccs and stop

Thirdspace
Hero Member
*****
Offline Offline

Activity: 1232
Merit: 738


Mixing reinvented for your privacy | chipmixer.com


View Profile
June 17, 2019, 11:57:56 PM
 #962

80 to 39vbryGKfcpuch6RLWa97BqG3rKFQQWJh7 and stop
85 to 3Qpip6a2oYgbrcomVpeaUZ4PVXsGVshuec and stop
so who found #80 and #85? no one has taken credits or posted their private keys here yet
are there other local (russian etc) threads about this topic?

An interesting situation. The numbers 65, 70, 75, 80, 85 were transferred to different multi-addresses 3 ...., and no further movement. If there was one person. That would merge on one address, and probably would use these funds. And so some strange movement.
I think they were claimed by different person
#65 by arulbero
#70 by pikachunakapika
#75 by pikachunakapika
I'm just guessing here by reading past posts in this thread

Scorr
Member
**
Offline Offline

Activity: 73
Merit: 10


View Profile
June 18, 2019, 01:38:54 PM
 #963

Hi, I still have to understand, how do they use that script in python with the gpu.  Huh Huh Huh Huh

supika
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
June 18, 2019, 01:52:51 PM
 #964

Hi, I still have to understand, how do they use that script in python with the gpu.  Huh Huh Huh Huh



This is also my question.

Maybe? https://developer.nvidia.com/how-to-cuda-python
Scorr
Member
**
Offline Offline

Activity: 73
Merit: 10


View Profile
June 18, 2019, 03:31:44 PM
 #965

Hi, I still have to understand, how do they use that script in python with the gpu.  Huh Huh Huh Huh



This is also my question.

Maybe? https://developer.nvidia.com/how-to-cuda-python

it's not so easy, you have to rewrite the python file to make it work with the gpu
JDScreesh
Jr. Member
*
Offline Offline

Activity: 39
Merit: 12


View Profile
June 18, 2019, 04:04:16 PM
 #966

Hi, I still have to understand, how do they use that script in python with the gpu.  Huh Huh Huh Huh



This is also my question.

Maybe? https://developer.nvidia.com/how-to-cuda-python

Good day. I don't understand so much but I think that script code is C (or C++), not python.  Smiley
n00by
Member
**
Offline Offline

Activity: 172
Merit: 11


View Profile
June 18, 2019, 07:06:07 PM
 #967

i think privkey #85,90,95,100 it's %5=0
supika
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
June 19, 2019, 09:16:24 AM
 #968

How is calculated the keyspace for each address? Thanks!
mrxtraf
Member
**
Offline Offline

Activity: 255
Merit: 27


View Profile WWW
June 19, 2019, 03:38:26 PM
 #969

A quantum comp is a myth, or an abstract horse in a vacuum.
But the brain !! Several petabytes of storage, with super access speed, and consumption of only 12 watts !!! I'm not talking about multi-threading anymore, there is a 10-bucks processor with 144 cores, it does not fall at all. Only it is necessary to write the program correctly  Grin Grin Grin Grin Yes, and docks on the language do not get it.  Cheesy Cheesy
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1136

All paid signature campaigns should be banned.


View Profile WWW
June 19, 2019, 06:21:45 PM
Merited by vapourminer (2)
 #970

How is calculated the keyspace for each address? Thanks!

The sequence number tells you exactly how many bits are in the private key:

#1 has 1 bit in the private key
#2 has 2 bits in the private key
#3 has 3 bits in the private key
...
#60 has 60 bits in the private key
#61 has 61 bits in the private key
#65 has 65 bits in the private key
#70 has 70 bits in the private key
#75 has 75 bits in the private key
...
#160 will have 160 bits in the private key

Do you understand now?

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
JDScreesh
Jr. Member
*
Offline Offline

Activity: 39
Merit: 12


View Profile
June 20, 2019, 10:02:01 PM
 #971

80 to 39vbryGKfcpuch6RLWa97BqG3rKFQQWJh7 and stop
85 to 3Qpip6a2oYgbrcomVpeaUZ4PVXsGVshuec and stop
so who found #80 and #85? no one has taken credits or posted their private keys here yet
are there other local (russian etc) threads about this topic?

An interesting situation. The numbers 65, 70, 75, 80, 85 were transferred to different multi-addresses 3 ...., and no further movement. If there was one person. That would merge on one address, and probably would use these funds. And so some strange movement.
I think they were claimed by different person
#65 by arulbero
#70 by pikachunakapika
#75 by pikachunakapika
I'm just guessing here by reading past posts in this thread
Still nobody saying anything about #80 and #85.

Meanwhile, maybe there is some reason why somebody is sending fractions of 0.00001 BTC to addresses #62, 63, 64 and 66 (and #01 too Grin )
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1136

All paid signature campaigns should be banned.


View Profile WWW
June 20, 2019, 10:29:37 PM
 #972

Meanwhile, maybe there is some reason why somebody is sending fractions of 0.00001 BTC to addresses #62, 63, 64 and 66 (and #01 too Grin )

I do not see why.  Sending BTC to an address does not expose any useful information.

Spending from an address obviously does expose useful information as we have seen.

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
jpyao78
Newbie
*
Offline Offline

Activity: 22
Merit: 0



View Profile
June 21, 2019, 12:23:48 AM
Last edit: June 21, 2019, 02:13:23 AM by jpyao78
 #973

I modified some code for catching bit90 with small memory
need someone to test Grin

Code:
/**********************************************************************
* Copyright (c) 2017, Jochen Hoenicke *
* *
* Compile with: *
* gcc -O2 -I secp256k1/src/ -I secp256k1/ break_short.c -lgmp *
**********************************************************************/

#include "libsecp256k1-config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <time.h>

#include "include/secp256k1.h"
#include "secp256k1.c"

//#define  MEM_SIZE    31  //for 64GB
#define  MEM_SIZE    30  //for 32GB
//#define  MEM_SIZE    29  //for 16GB
//#define  MEM_SIZE    28  //for 8GB
#define  CHECK_BITS  90

/* giant steps are 2^25 */
#define GSTEP ((uint64_t)1<<MEM_SIZE)


#define NUMPUBKEYS  17
unsigned char rawpubkeys[NUMPUBKEYS][33] = {
{ 0x03,0x29,0xc4,0x57,0x4a,0x4f,0xd8,0xc8,0x10,0xb7,0xe4,0x2a,0x4b,0x39,0x88,0x82,0xb3,0x81,0xbc,0xd8,0x5e,0x40,0xc6,0x88,0x37,0x12,0x91,0x2d,0x16,0x7c,0x83,0xe7,0x3a },//== 1Kh22PvXERd2xpTQk3ur6pPEqFeckCJfAr#85
{ 0x03,0x5c,0x38,0xbd,0x9a,0xe4,0xb1,0x0e,0x8a,0x25,0x08,0x57,0x00,0x6f,0x3c,0xfd,0x98,0xab,0x15,0xa6,0x19,0x6d,0x9f,0x4d,0xfd,0x25,0xbc,0x7e,0xcc,0x77,0xd7,0x88,0xd5 },//== 1L12FHH2FHjvTviyanuiFVfmzCy46RRATU#90
{ 0x02,0x96,0x7a,0x59,0x05,0xd6,0xf3,0xb4,0x20,0x95,0x9a,0x02,0x78,0x9f,0x96,0xab,0x4c,0x32,0x23,0xa2,0xc4,0xd2,0x76,0x2f,0x81,0x7b,0x78,0x95,0xc5,0xbc,0x88,0xa0,0x45 },//== 19eVSDuizydXxhohGh8Ki9WY9KsHdSwoQC#95
{ 0x03,0xd2,0x06,0x3d,0x40,0x40,0x2f,0x03,0x0d,0x4c,0xc7,0x13,0x31,0x46,0x88,0x27,0xaa,0x41,0xa8,0xa0,0x9b,0xd6,0xfd,0x80,0x1b,0xa7,0x7f,0xb6,0x4f,0x8e,0x67,0xe6,0x17 },//== 1KCgMv8fo2TPBpddVi9jqmMmcne9uSNJ5F#100
{ 0x03,0xbc,0xf7,0xce,0x88,0x7f,0xfc,0xa5,0xe6,0x2c,0x9c,0xab,0xbd,0xb7,0xff,0xa7,0x1d,0xc1,0x83,0xc5,0x2c,0x04,0xff,0x4e,0xe5,0xee,0x82,0xe0,0xc5,0x5c,0x39,0xd7,0x7b },//== 1CMjscKB3QW7SDyQ4c3C3DEUHiHRhiZVib#105
{ 0x03,0x09,0x97,0x6b,0xa5,0x57,0x09,0x66,0xbf,0x88,0x91,0x96,0xb7,0xfd,0xf5,0xa0,0xf9,0xa1,0xe9,0xab,0x34,0x05,0x56,0xec,0x29,0xf8,0xbb,0x60,0x59,0x96,0x16,0x16,0x7d },//== 12JzYkkN76xkwvcPT6AWKZtGX6w2LAgsJg#110
{ 0x02,0x48,0xd3,0x13,0xb0,0x39,0x8d,0x49,0x23,0xcd,0xca,0x73,0xb8,0xcf,0xa6,0x53,0x2b,0x91,0xb9,0x67,0x03,0x90,0x2f,0xc8,0xb3,0x2f,0xd4,0x38,0xa3,0xb7,0xcd,0x7f,0x55 },//== 1NLbHuJebVwUZ1XqDjsAyfTRUPwDQbemfv#115
{ 0x02,0xce,0xb6,0xcb,0xbc,0xdb,0xdf,0x5e,0xf7,0x15,0x06,0x82,0x15,0x0f,0x4c,0xe2,0xc6,0xf4,0x80,0x7b,0x34,0x98,0x27,0xdc,0xdb,0xdd,0x1f,0x2e,0xfa,0x88,0x5a,0x26,0x30 },//== 17s2b9ksz5y7abUm92cHwG8jEPCzK3dLnT#120
{ 0x02,0x33,0x70,0x9e,0xb1,0x1e,0x0d,0x44,0x39,0xa7,0x29,0xf2,0x1c,0x2c,0x44,0x3d,0xed,0xb7,0x27,0x52,0x82,0x29,0x71,0x3f,0x00,0x65,0x72,0x1b,0xa8,0xfa,0x46,0xf0,0x0e },//== 1PXAyUB8ZoH3WD8n5zoAthYjN15yN5CVq5#125
{ 0x03,0x63,0x3c,0xbe,0x3e,0xc0,0x2b,0x94,0x01,0xc5,0xef,0xfa,0x14,0x4c,0x5b,0x4d,0x22,0xf8,0x79,0x40,0x25,0x96,0x34,0x85,0x8f,0xc7,0xe5,0x9b,0x1c,0x09,0x93,0x78,0x52 },//== 1Fo65aKq8s8iquMt6weF1rku1moWVEd5Ua#130
{ 0x02,0x14,0x5d,0x26,0x11,0xc8,0x23,0xa3,0x96,0xef,0x67,0x12,0xce,0x0f,0x71,0x2f,0x09,0xb9,0xb4,0xf3,0x13,0x5e,0x3e,0x0a,0xa3,0x23,0x0f,0xb9,0xb6,0xd0,0x8d,0x1e,0x16 },//== 16RGFo6hjq9ym6Pj7N5H7L1NR1rVPJyw2v#135
{ 0x03,0x1f,0x6a,0x33,0x2d,0x3c,0x5c,0x4f,0x2d,0xe2,0x37,0x8c,0x01,0x2f,0x42,0x9c,0xd1,0x09,0xba,0x07,0xd6,0x96,0x90,0xc6,0xc7,0x01,0xb6,0xbb,0x87,0x86,0x0d,0x66,0x40 },//== 1QKBaU6WAeycb3DbKbLBkX7vJiaS8r42Xo#140
{ 0x03,0xaf,0xdd,0xa4,0x97,0x36,0x9e,0x21,0x9a,0x2c,0x1c,0x36,0x99,0x54,0xa9,0x30,0xe4,0xd3,0x74,0x09,0x68,0xe5,0xe4,0x35,0x24,0x75,0xbc,0xff,0xce,0x31,0x40,0xda,0xe5 },//== 19GpszRNUej5yYqxXoLnbZWKew3KdVLkXg#145
{ 0x03,0x13,0x78,0x07,0x79,0x0e,0xa7,0xdc,0x6e,0x97,0x90,0x1c,0x2b,0xc8,0x74,0x11,0xf4,0x5e,0xd7,0x4a,0x56,0x29,0x31,0x5c,0x4e,0x4b,0x03,0xa0,0xa1,0x02,0x25,0x0c,0x49 },//== 1MUJSJYtGPVGkBCTqGspnxyHahpt5Te8jy#150
{ 0x03,0x5c,0xd1,0x85,0x4c,0xae,0x45,0x39,0x1c,0xa4,0xec,0x42,0x8c,0xc7,0xe6,0xc7,0xd9,0x98,0x44,0x24,0xb9,0x54,0x20,0x9a,0x8e,0xea,0x19,0x7b,0x9e,0x36,0x4c,0x05,0xf6 },//== 1AoeP37TmHdFh8uN72fu9AqgtLrUwcv2wJ#155
{ 0x02,0xe0,0xa8,0xb0,0x39,0x28,0x2f,0xaf,0x6f,0xe0,0xfd,0x76,0x9c,0xfb,0xc4,0xb6,0xb4,0xcf,0x87,0x58,0xba,0x68,0x22,0x0e,0xac,0x42,0x0e,0x32,0xb9,0x1d,0xdf,0xa6,0x73 },//== 1NBC8uXJy1GiJ6drkiZa1WuKn51ps7EPTv#160
{ 0x02,0x5f,0x86,0x4e,0x8c,0xa1,0xe1,0x5a,0x54,0x1e,0xfa,0x6a,0x65,0x9b,0x4a,0x6e,0xb1,0xe3,0xab,0x4a,0xe8,0xeb,0x80,0xcf,0x7f,0x0b,0xdc,0xad,0xfb,0x16,0x52,0x5b,0x18 },//== 1PvaqLqRAivje7CactLR55xQBYvBeaDrXN
};

typedef struct hashtable_entry {
    uint32_t x2;
    uint32_t x3;
    uint32_t exponent;
} hashtable_entry;

#define HASH_SIZE (2*GSTEP)
hashtable_entry table[HASH_SIZE];
secp256k1_ge pubkeys[NUMPUBKEYS];

int main(int argc, char **argv) {
    secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);

    int next = 0;
    
    for (int i = 0; i < NUMPUBKEYS; i++) {
        if (!secp256k1_eckey_pubkey_parse(&pubkeys[i], rawpubkeys[i], 33)) {
            printf("Unparsable pubkey %2d\n", i);
            return -1;
        }
    }

    printf("Check bit = %d only, pubkey is:\n",CHECK_BITS);
    for(uint32_t i= 0;i<33;i++)
      printf("%02x",rawpubkeys[CHECK_BITS/5 - 17][i]);
    printf("\n");
      

    int shift_gmax;
    shift_gmax = CHECK_BITS - MEM_SIZE*2 -1;
    if(shift_gmax <0 ){
       printf("Error, CHECK_BITS too small =%d, should >= %d\n",CHECK_BITS, MEM_SIZE*2 +1);
       return 1;
    }

    unsigned int skip_bits;
    skip_bits = CHECK_BITS - MEM_SIZE -2;
    //printf("skip bits %d\n",skip_bits);

    uint64_t skip;
    uint64_t g_max;
    skip  = (uint64_t)0x1 << skip_bits;
    g_max = ((uint64_t)0x1 << shift_gmax)* (uint64_t)(GSTEP);
    //printf("skip %016lx gmax %016lx\n",skip,g_max);

    uint128_t rstart,rend;
    uint64_t start_hi,start_lo;
    uint64_t end_hi,end_lo;

    rstart   = (uint128_t)skip *(uint128_t)(HASH_SIZE);
    rend     = (uint128_t)g_max*(uint128_t)(HASH_SIZE)-1;
    start_lo = rstart;
    start_hi = rstart>>64;
    end_lo   = rend;
    end_hi   = rend>>64;

    uint64_t one_table_bytes;
    one_table_bytes = (uint64_t)&table[1] - (uint64_t)&table[0];

    printf("Build Hash, MEM size = %dGB\n", (uint32_t)(HASH_SIZE*one_table_bytes>>30));
    secp256k1_gej pt;
    secp256k1_gej_set_ge(&pt, &secp256k1_ge_const_g);
    for (uint64_t i = 1; i < GSTEP; i++) {
        secp256k1_fe x,zinv;
        secp256k1_fe_storage xst;

        secp256k1_fe_inv_var(&zinv, &pt.z);
        secp256k1_fe_sqr(&zinv, &zinv);
        secp256k1_fe_mul(&x, &pt.x, &zinv);
        secp256k1_fe_to_storage(&xst, &x);
        uint32_t entry = xst.n[0] & (HASH_SIZE-1);
        while (table[entry].exponent != 0) {
            entry = (entry + (xst.n[1] | 1)) & (HASH_SIZE - 1);
        }
        table[entry].exponent = i;
        table[entry].x2 = (uint32_t)xst.n[2];
        table[entry].x3 = (uint32_t)xst.n[3];
        secp256k1_gej_add_ge_var(&pt, &pt, &secp256k1_ge_const_g, NULL);
    }

    secp256k1_ge ptgstep;
    secp256k1_gej_neg(&pt, &pt);
    secp256k1_gej_double_var(&pt, &pt, NULL);


    secp256k1_ge_set_gej(&ptgstep, &pt);

    //secp256k1_gej_set_infinity(&pt);
    

    printf("Search bits = %d\n",CHECK_BITS);
    //skip some point by power of 2, we dont care 0 to start point
    //TODO update to random postion in a region
    for (uint64_t i = 0; i < skip_bits; i+=1) {
      secp256k1_gej_double_var(&pt, &pt, NULL);
    }

    printf("Search Keys....  from %lx%016lx to %lx%016lx\n",start_hi,start_lo, end_hi,end_lo);
    for (uint64_t i = skip; i < g_max; i++) {

//        for (int j = next; j < NUMPUBKEYS; j++) {
            secp256k1_gej diff;
            secp256k1_fe x,zinv;
            secp256k1_fe_storage xst;

            secp256k1_gej_add_ge_var(&diff, &pt, &pubkeys[CHECK_BITS/5 - 17], NULL);//check
            secp256k1_fe_inv_var(&zinv, &diff.z);
            secp256k1_fe_sqr(&zinv, &zinv);
            secp256k1_fe_mul(&x, &diff.x, &zinv);
            secp256k1_fe_to_storage(&xst, &x);


            uint32_t entry = xst.n[0] & (HASH_SIZE-1);
            while (table[entry].exponent != 0) {
                //if (table[entry].x == (uint32_t) xst.n[2]) {
                if ((table[entry].x2 == (uint32_t)xst.n[2]) && (table[entry].x3 == (uint32_t)xst.n[3])) {

                    uint128_t key = (uint128_t) i *  (uint128_t) (2 * GSTEP);

                    uint128_t key1 = key - table[entry].exponent ;
                    uint128_t key2 = key + table[entry].exponent;

   uint64_t key1lo = key1;
   uint64_t key1hi = (key1 >> 64);
   uint64_t key2lo = key2;
   uint64_t key2hi = (key2 >> 64);
                    printf("Found private key %2d: %lx%016lx or %lx%016lx\n", CHECK_BITS,  key1hi,key1lo,key2hi,key2lo);

                    FILE *fp = fopen("key.log","a+");
//                    fprintf(fp,"Found private, i=%16lx, x 2 x %16lx, exp=%x\n",(uint64_t)i,GSTEP,table[entry].exponent);
                    fprintf(fp,"Found private key %2d: %lx%016lx or %lx%016lx\n", CHECK_BITS,  key1hi,key1lo,key2hi,key2lo);
                    fclose(fp);
 
//                    next++;
                    //if (next == NUMPUBKEYS)
                        return 0;
                }        
                entry = (entry + (xst.n[1] | 1)) & (HASH_SIZE - 1);
            }
         //   if (j == next)
         //       break;
        //}
        //
        secp256k1_gej_add_ge_var(&pt, &pt, &ptgstep, NULL);
    }
    return 0;
}

jpyao78
Newbie
*
Offline Offline

Activity: 22
Merit: 0



View Profile
June 21, 2019, 02:17:42 AM
 #974

any for windows ? 2080ti to test
this code is for CPU only
rud3boy
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
June 21, 2019, 10:14:26 AM
Last edit: June 21, 2019, 10:38:56 AM by rud3boy
 #975

But is there a was to Start the generation of the hashtable, inside the bit-space. And not at the beginning???
*Edit
Or just a range inside a bit-space?

For example:

Bit-space 90
Just the range 80%-90% of the whole 90bit-space?
supika
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
June 21, 2019, 12:02:12 PM
Last edit: June 21, 2019, 12:22:51 PM by supika
 #976

I modified some code for catching bit90 with small memory
need someone to test Grin

Code:
/**********************************************************************
* Copyright (c) 2017, Jochen Hoenicke *
* *
* Compile with: *
* gcc -O2 -I secp256k1/src/ -I secp256k1/ break_short.c -lgmp *
**********************************************************************/

#include "libsecp256k1-config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <time.h>

#include "include/secp256k1.h"
#include "secp256k1.c"

//#define  MEM_SIZE    31  //for 64GB
#define  MEM_SIZE    30  //for 32GB
//#define  MEM_SIZE    29  //for 16GB
//#define  MEM_SIZE    28  //for 8GB
#define  CHECK_BITS  90

/* giant steps are 2^25 */
#define GSTEP ((uint64_t)1<<MEM_SIZE)


#define NUMPUBKEYS  17
unsigned char rawpubkeys[NUMPUBKEYS][33] = {
{ 0x03,0x29,0xc4,0x57,0x4a,0x4f,0xd8,0xc8,0x10,0xb7,0xe4,0x2a,0x4b,0x39,0x88,0x82,0xb3,0x81,0xbc,0xd8,0x5e,0x40,0xc6,0x88,0x37,0x12,0x91,0x2d,0x16,0x7c,0x83,0xe7,0x3a },//== 1Kh22PvXERd2xpTQk3ur6pPEqFeckCJfAr#85
{ 0x03,0x5c,0x38,0xbd,0x9a,0xe4,0xb1,0x0e,0x8a,0x25,0x08,0x57,0x00,0x6f,0x3c,0xfd,0x98,0xab,0x15,0xa6,0x19,0x6d,0x9f,0x4d,0xfd,0x25,0xbc,0x7e,0xcc,0x77,0xd7,0x88,0xd5 },//== 1L12FHH2FHjvTviyanuiFVfmzCy46RRATU#90
{ 0x02,0x96,0x7a,0x59,0x05,0xd6,0xf3,0xb4,0x20,0x95,0x9a,0x02,0x78,0x9f,0x96,0xab,0x4c,0x32,0x23,0xa2,0xc4,0xd2,0x76,0x2f,0x81,0x7b,0x78,0x95,0xc5,0xbc,0x88,0xa0,0x45 },//== 19eVSDuizydXxhohGh8Ki9WY9KsHdSwoQC#95
{ 0x03,0xd2,0x06,0x3d,0x40,0x40,0x2f,0x03,0x0d,0x4c,0xc7,0x13,0x31,0x46,0x88,0x27,0xaa,0x41,0xa8,0xa0,0x9b,0xd6,0xfd,0x80,0x1b,0xa7,0x7f,0xb6,0x4f,0x8e,0x67,0xe6,0x17 },//== 1KCgMv8fo2TPBpddVi9jqmMmcne9uSNJ5F#100
{ 0x03,0xbc,0xf7,0xce,0x88,0x7f,0xfc,0xa5,0xe6,0x2c,0x9c,0xab,0xbd,0xb7,0xff,0xa7,0x1d,0xc1,0x83,0xc5,0x2c,0x04,0xff,0x4e,0xe5,0xee,0x82,0xe0,0xc5,0x5c,0x39,0xd7,0x7b },//== 1CMjscKB3QW7SDyQ4c3C3DEUHiHRhiZVib#105
{ 0x03,0x09,0x97,0x6b,0xa5,0x57,0x09,0x66,0xbf,0x88,0x91,0x96,0xb7,0xfd,0xf5,0xa0,0xf9,0xa1,0xe9,0xab,0x34,0x05,0x56,0xec,0x29,0xf8,0xbb,0x60,0x59,0x96,0x16,0x16,0x7d },//== 12JzYkkN76xkwvcPT6AWKZtGX6w2LAgsJg#110
{ 0x02,0x48,0xd3,0x13,0xb0,0x39,0x8d,0x49,0x23,0xcd,0xca,0x73,0xb8,0xcf,0xa6,0x53,0x2b,0x91,0xb9,0x67,0x03,0x90,0x2f,0xc8,0xb3,0x2f,0xd4,0x38,0xa3,0xb7,0xcd,0x7f,0x55 },//== 1NLbHuJebVwUZ1XqDjsAyfTRUPwDQbemfv#115
{ 0x02,0xce,0xb6,0xcb,0xbc,0xdb,0xdf,0x5e,0xf7,0x15,0x06,0x82,0x15,0x0f,0x4c,0xe2,0xc6,0xf4,0x80,0x7b,0x34,0x98,0x27,0xdc,0xdb,0xdd,0x1f,0x2e,0xfa,0x88,0x5a,0x26,0x30 },//== 17s2b9ksz5y7abUm92cHwG8jEPCzK3dLnT#120
{ 0x02,0x33,0x70,0x9e,0xb1,0x1e,0x0d,0x44,0x39,0xa7,0x29,0xf2,0x1c,0x2c,0x44,0x3d,0xed,0xb7,0x27,0x52,0x82,0x29,0x71,0x3f,0x00,0x65,0x72,0x1b,0xa8,0xfa,0x46,0xf0,0x0e },//== 1PXAyUB8ZoH3WD8n5zoAthYjN15yN5CVq5#125
{ 0x03,0x63,0x3c,0xbe,0x3e,0xc0,0x2b,0x94,0x01,0xc5,0xef,0xfa,0x14,0x4c,0x5b,0x4d,0x22,0xf8,0x79,0x40,0x25,0x96,0x34,0x85,0x8f,0xc7,0xe5,0x9b,0x1c,0x09,0x93,0x78,0x52 },//== 1Fo65aKq8s8iquMt6weF1rku1moWVEd5Ua#130
{ 0x02,0x14,0x5d,0x26,0x11,0xc8,0x23,0xa3,0x96,0xef,0x67,0x12,0xce,0x0f,0x71,0x2f,0x09,0xb9,0xb4,0xf3,0x13,0x5e,0x3e,0x0a,0xa3,0x23,0x0f,0xb9,0xb6,0xd0,0x8d,0x1e,0x16 },//== 16RGFo6hjq9ym6Pj7N5H7L1NR1rVPJyw2v#135
{ 0x03,0x1f,0x6a,0x33,0x2d,0x3c,0x5c,0x4f,0x2d,0xe2,0x37,0x8c,0x01,0x2f,0x42,0x9c,0xd1,0x09,0xba,0x07,0xd6,0x96,0x90,0xc6,0xc7,0x01,0xb6,0xbb,0x87,0x86,0x0d,0x66,0x40 },//== 1QKBaU6WAeycb3DbKbLBkX7vJiaS8r42Xo#140
{ 0x03,0xaf,0xdd,0xa4,0x97,0x36,0x9e,0x21,0x9a,0x2c,0x1c,0x36,0x99,0x54,0xa9,0x30,0xe4,0xd3,0x74,0x09,0x68,0xe5,0xe4,0x35,0x24,0x75,0xbc,0xff,0xce,0x31,0x40,0xda,0xe5 },//== 19GpszRNUej5yYqxXoLnbZWKew3KdVLkXg#145
{ 0x03,0x13,0x78,0x07,0x79,0x0e,0xa7,0xdc,0x6e,0x97,0x90,0x1c,0x2b,0xc8,0x74,0x11,0xf4,0x5e,0xd7,0x4a,0x56,0x29,0x31,0x5c,0x4e,0x4b,0x03,0xa0,0xa1,0x02,0x25,0x0c,0x49 },//== 1MUJSJYtGPVGkBCTqGspnxyHahpt5Te8jy#150
{ 0x03,0x5c,0xd1,0x85,0x4c,0xae,0x45,0x39,0x1c,0xa4,0xec,0x42,0x8c,0xc7,0xe6,0xc7,0xd9,0x98,0x44,0x24,0xb9,0x54,0x20,0x9a,0x8e,0xea,0x19,0x7b,0x9e,0x36,0x4c,0x05,0xf6 },//== 1AoeP37TmHdFh8uN72fu9AqgtLrUwcv2wJ#155
{ 0x02,0xe0,0xa8,0xb0,0x39,0x28,0x2f,0xaf,0x6f,0xe0,0xfd,0x76,0x9c,0xfb,0xc4,0xb6,0xb4,0xcf,0x87,0x58,0xba,0x68,0x22,0x0e,0xac,0x42,0x0e,0x32,0xb9,0x1d,0xdf,0xa6,0x73 },//== 1NBC8uXJy1GiJ6drkiZa1WuKn51ps7EPTv#160
{ 0x02,0x5f,0x86,0x4e,0x8c,0xa1,0xe1,0x5a,0x54,0x1e,0xfa,0x6a,0x65,0x9b,0x4a,0x6e,0xb1,0xe3,0xab,0x4a,0xe8,0xeb,0x80,0xcf,0x7f,0x0b,0xdc,0xad,0xfb,0x16,0x52,0x5b,0x18 },//== 1PvaqLqRAivje7CactLR55xQBYvBeaDrXN
};

typedef struct hashtable_entry {
    uint32_t x2;
    uint32_t x3;
    uint32_t exponent;
} hashtable_entry;

#define HASH_SIZE (2*GSTEP)
hashtable_entry table[HASH_SIZE];
secp256k1_ge pubkeys[NUMPUBKEYS];

int main(int argc, char **argv) {
    secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);

    int next = 0;
    
    for (int i = 0; i < NUMPUBKEYS; i++) {
        if (!secp256k1_eckey_pubkey_parse(&pubkeys[i], rawpubkeys[i], 33)) {
            printf("Unparsable pubkey %2d\n", i);
            return -1;
        }
    }

    printf("Check bit = %d only, pubkey is:\n",CHECK_BITS);
    for(uint32_t i= 0;i<33;i++)
      printf("%02x",rawpubkeys[CHECK_BITS/5 - 17][i]);
    printf("\n");
      

    int shift_gmax;
    shift_gmax = CHECK_BITS - MEM_SIZE*2 -1;
    if(shift_gmax <0 ){
       printf("Error, CHECK_BITS too small =%d, should >= %d\n",CHECK_BITS, MEM_SIZE*2 +1);
       return 1;
    }

    unsigned int skip_bits;
    skip_bits = CHECK_BITS - MEM_SIZE -2;
    //printf("skip bits %d\n",skip_bits);

    uint64_t skip;
    uint64_t g_max;
    skip  = (uint64_t)0x1 << skip_bits;
    g_max = ((uint64_t)0x1 << shift_gmax)* (uint64_t)(GSTEP);
    //printf("skip %016lx gmax %016lx\n",skip,g_max);

    uint128_t rstart,rend;
    uint64_t start_hi,start_lo;
    uint64_t end_hi,end_lo;

    rstart   = (uint128_t)skip *(uint128_t)(HASH_SIZE);
    rend     = (uint128_t)g_max*(uint128_t)(HASH_SIZE)-1;
    start_lo = rstart;
    start_hi = rstart>>64;
    end_lo   = rend;
    end_hi   = rend>>64;

    uint64_t one_table_bytes;
    one_table_bytes = (uint64_t)&table[1] - (uint64_t)&table[0];

    printf("Build Hash, MEM size = %dGB\n", (uint32_t)(HASH_SIZE*one_table_bytes>>30));
    secp256k1_gej pt;
    secp256k1_gej_set_ge(&pt, &secp256k1_ge_const_g);
    for (uint64_t i = 1; i < GSTEP; i++) {
        secp256k1_fe x,zinv;
        secp256k1_fe_storage xst;

        secp256k1_fe_inv_var(&zinv, &pt.z);
        secp256k1_fe_sqr(&zinv, &zinv);
        secp256k1_fe_mul(&x, &pt.x, &zinv);
        secp256k1_fe_to_storage(&xst, &x);
        uint32_t entry = xst.n[0] & (HASH_SIZE-1);
        while (table[entry].exponent != 0) {
            entry = (entry + (xst.n[1] | 1)) & (HASH_SIZE - 1);
        }
        table[entry].exponent = i;
        table[entry].x2 = (uint32_t)xst.n[2];
        table[entry].x3 = (uint32_t)xst.n[3];
        secp256k1_gej_add_ge_var(&pt, &pt, &secp256k1_ge_const_g, NULL);
    }

    secp256k1_ge ptgstep;
    secp256k1_gej_neg(&pt, &pt);
    secp256k1_gej_double_var(&pt, &pt, NULL);


    secp256k1_ge_set_gej(&ptgstep, &pt);

    //secp256k1_gej_set_infinity(&pt);
    

    printf("Search bits = %d\n",CHECK_BITS);
    //skip some point by power of 2, we dont care 0 to start point
    //TODO update to random postion in a region
    for (uint64_t i = 0; i < skip_bits; i+=1) {
      secp256k1_gej_double_var(&pt, &pt, NULL);
    }

    printf("Search Keys....  from %lx%016lx to %lx%016lx\n",start_hi,start_lo, end_hi,end_lo);
    for (uint64_t i = skip; i < g_max; i++) {

//        for (int j = next; j < NUMPUBKEYS; j++) {
            secp256k1_gej diff;
            secp256k1_fe x,zinv;
            secp256k1_fe_storage xst;

            secp256k1_gej_add_ge_var(&diff, &pt, &pubkeys[CHECK_BITS/5 - 17], NULL);//check
            secp256k1_fe_inv_var(&zinv, &diff.z);
            secp256k1_fe_sqr(&zinv, &zinv);
            secp256k1_fe_mul(&x, &diff.x, &zinv);
            secp256k1_fe_to_storage(&xst, &x);


            uint32_t entry = xst.n[0] & (HASH_SIZE-1);
            while (table[entry].exponent != 0) {
                //if (table[entry].x == (uint32_t) xst.n[2]) {
                if ((table[entry].x2 == (uint32_t)xst.n[2]) && (table[entry].x3 == (uint32_t)xst.n[3])) {

                    uint128_t key = (uint128_t) i *  (uint128_t) (2 * GSTEP);

                    uint128_t key1 = key - table[entry].exponent ;
                    uint128_t key2 = key + table[entry].exponent;

   uint64_t key1lo = key1;
   uint64_t key1hi = (key1 >> 64);
   uint64_t key2lo = key2;
   uint64_t key2hi = (key2 >> 64);
                    printf("Found private key %2d: %lx%016lx or %lx%016lx\n", CHECK_BITS,  key1hi,key1lo,key2hi,key2lo);

                    FILE *fp = fopen("key.log","a+");
//                    fprintf(fp,"Found private, i=%16lx, x 2 x %16lx, exp=%x\n",(uint64_t)i,GSTEP,table[entry].exponent);
                    fprintf(fp,"Found private key %2d: %lx%016lx or %lx%016lx\n", CHECK_BITS,  key1hi,key1lo,key2hi,key2lo);
                    fclose(fp);
 
//                    next++;
                    //if (next == NUMPUBKEYS)
                        return 0;
                }        
                entry = (entry + (xst.n[1] | 1)) & (HASH_SIZE - 1);
            }
         //   if (j == next)
         //       break;
        //}
        //
        secp256k1_gej_add_ge_var(&pt, &pt, &ptgstep, NULL);
    }
    return 0;
}



sup@vm:~/Downloads$ ./break-short.exe
Check bit = 90 only, pubkey is:
035c38bd9ae4b10e8a250857006f3cfd98ab15a6196d9f4dfd25bc7ecc77d788d5
Build Hash, MEM size = 48GB

I have 64GB of RAM on the VM but is taking 48.
How long will take for building hash ?
The script can be used with more than 64 RAM?
jpyao78
Newbie
*
Offline Offline

Activity: 22
Merit: 0



View Profile
June 21, 2019, 12:29:39 PM
 #977

But is there a was to Start the generation of the hashtable, inside the bit-space. And not at the beginning???
*Edit
Or just a range inside a bit-space?

For example:

Bit-space 90
Just the range 80%-90% of the whole 90bit-space?

The Baby-Step hashtable should be generated from beginning and should occupy most of the memory.
We need to speed up the generation process.

The Giant-Step range is too big for bit90, it's from 20000000000000000000000/HASH_SIZE to 3ffffffffffffffffffffff/HASH_SIZE
Need to select a random start, but I don't know how to change the code.


mrxtraf
Member
**
Offline Offline

Activity: 255
Merit: 27


View Profile WWW
June 21, 2019, 12:44:37 PM
 #978

define  MEM_SIZE    31

Segmentation fault
rud3boy
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
June 21, 2019, 12:48:21 PM
 #979

Alright,
but maybe you can explain your changes a lil bit, for non C-pros. Grin

And I mean, since the searchspace is really big, isn't it  possilble to set a custom range?
   
3faaaaaaaaaaaaaaaaaaaaa to 3ffffffffffffffffffffff
racminer
Member
**
Offline Offline

Activity: 242
Merit: 17


View Profile
June 21, 2019, 01:35:20 PM
 #980

I modified some code for catching bit90 with small memory
need someone to test Grin

Code:
/**********************************************************************
* Copyright (c) 2017, Jochen Hoenicke *
* *
* Compile with: *
* gcc -O2 -I secp256k1/src/ -I secp256k1/ break_short.c -lgmp *
**********************************************************************/

#include "libsecp256k1-config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <time.h>

#include "include/secp256k1.h"
#include "secp256k1.c"

//#define  MEM_SIZE    31  //for 64GB
#define  MEM_SIZE    30  //for 32GB
//#define  MEM_SIZE    29  //for 16GB
//#define  MEM_SIZE    28  //for 8GB
#define  CHECK_BITS  90

/* giant steps are 2^25 */
#define GSTEP ((uint64_t)1<<MEM_SIZE)


#define NUMPUBKEYS  17
unsigned char rawpubkeys[NUMPUBKEYS][33] = {
{ 0x03,0x29,0xc4,0x57,0x4a,0x4f,0xd8,0xc8,0x10,0xb7,0xe4,0x2a,0x4b,0x39,0x88,0x82,0xb3,0x81,0xbc,0xd8,0x5e,0x40,0xc6,0x88,0x37,0x12,0x91,0x2d,0x16,0x7c,0x83,0xe7,0x3a },//== 1Kh22PvXERd2xpTQk3ur6pPEqFeckCJfAr#85
{ 0x03,0x5c,0x38,0xbd,0x9a,0xe4,0xb1,0x0e,0x8a,0x25,0x08,0x57,0x00,0x6f,0x3c,0xfd,0x98,0xab,0x15,0xa6,0x19,0x6d,0x9f,0x4d,0xfd,0x25,0xbc,0x7e,0xcc,0x77,0xd7,0x88,0xd5 },//== 1L12FHH2FHjvTviyanuiFVfmzCy46RRATU#90
{ 0x02,0x96,0x7a,0x59,0x05,0xd6,0xf3,0xb4,0x20,0x95,0x9a,0x02,0x78,0x9f,0x96,0xab,0x4c,0x32,0x23,0xa2,0xc4,0xd2,0x76,0x2f,0x81,0x7b,0x78,0x95,0xc5,0xbc,0x88,0xa0,0x45 },//== 19eVSDuizydXxhohGh8Ki9WY9KsHdSwoQC#95
{ 0x03,0xd2,0x06,0x3d,0x40,0x40,0x2f,0x03,0x0d,0x4c,0xc7,0x13,0x31,0x46,0x88,0x27,0xaa,0x41,0xa8,0xa0,0x9b,0xd6,0xfd,0x80,0x1b,0xa7,0x7f,0xb6,0x4f,0x8e,0x67,0xe6,0x17 },//== 1KCgMv8fo2TPBpddVi9jqmMmcne9uSNJ5F#100
{ 0x03,0xbc,0xf7,0xce,0x88,0x7f,0xfc,0xa5,0xe6,0x2c,0x9c,0xab,0xbd,0xb7,0xff,0xa7,0x1d,0xc1,0x83,0xc5,0x2c,0x04,0xff,0x4e,0xe5,0xee,0x82,0xe0,0xc5,0x5c,0x39,0xd7,0x7b },//== 1CMjscKB3QW7SDyQ4c3C3DEUHiHRhiZVib#105
{ 0x03,0x09,0x97,0x6b,0xa5,0x57,0x09,0x66,0xbf,0x88,0x91,0x96,0xb7,0xfd,0xf5,0xa0,0xf9,0xa1,0xe9,0xab,0x34,0x05,0x56,0xec,0x29,0xf8,0xbb,0x60,0x59,0x96,0x16,0x16,0x7d },//== 12JzYkkN76xkwvcPT6AWKZtGX6w2LAgsJg#110
{ 0x02,0x48,0xd3,0x13,0xb0,0x39,0x8d,0x49,0x23,0xcd,0xca,0x73,0xb8,0xcf,0xa6,0x53,0x2b,0x91,0xb9,0x67,0x03,0x90,0x2f,0xc8,0xb3,0x2f,0xd4,0x38,0xa3,0xb7,0xcd,0x7f,0x55 },//== 1NLbHuJebVwUZ1XqDjsAyfTRUPwDQbemfv#115
{ 0x02,0xce,0xb6,0xcb,0xbc,0xdb,0xdf,0x5e,0xf7,0x15,0x06,0x82,0x15,0x0f,0x4c,0xe2,0xc6,0xf4,0x80,0x7b,0x34,0x98,0x27,0xdc,0xdb,0xdd,0x1f,0x2e,0xfa,0x88,0x5a,0x26,0x30 },//== 17s2b9ksz5y7abUm92cHwG8jEPCzK3dLnT#120
{ 0x02,0x33,0x70,0x9e,0xb1,0x1e,0x0d,0x44,0x39,0xa7,0x29,0xf2,0x1c,0x2c,0x44,0x3d,0xed,0xb7,0x27,0x52,0x82,0x29,0x71,0x3f,0x00,0x65,0x72,0x1b,0xa8,0xfa,0x46,0xf0,0x0e },//== 1PXAyUB8ZoH3WD8n5zoAthYjN15yN5CVq5#125
{ 0x03,0x63,0x3c,0xbe,0x3e,0xc0,0x2b,0x94,0x01,0xc5,0xef,0xfa,0x14,0x4c,0x5b,0x4d,0x22,0xf8,0x79,0x40,0x25,0x96,0x34,0x85,0x8f,0xc7,0xe5,0x9b,0x1c,0x09,0x93,0x78,0x52 },//== 1Fo65aKq8s8iquMt6weF1rku1moWVEd5Ua#130
{ 0x02,0x14,0x5d,0x26,0x11,0xc8,0x23,0xa3,0x96,0xef,0x67,0x12,0xce,0x0f,0x71,0x2f,0x09,0xb9,0xb4,0xf3,0x13,0x5e,0x3e,0x0a,0xa3,0x23,0x0f,0xb9,0xb6,0xd0,0x8d,0x1e,0x16 },//== 16RGFo6hjq9ym6Pj7N5H7L1NR1rVPJyw2v#135
{ 0x03,0x1f,0x6a,0x33,0x2d,0x3c,0x5c,0x4f,0x2d,0xe2,0x37,0x8c,0x01,0x2f,0x42,0x9c,0xd1,0x09,0xba,0x07,0xd6,0x96,0x90,0xc6,0xc7,0x01,0xb6,0xbb,0x87,0x86,0x0d,0x66,0x40 },//== 1QKBaU6WAeycb3DbKbLBkX7vJiaS8r42Xo#140
{ 0x03,0xaf,0xdd,0xa4,0x97,0x36,0x9e,0x21,0x9a,0x2c,0x1c,0x36,0x99,0x54,0xa9,0x30,0xe4,0xd3,0x74,0x09,0x68,0xe5,0xe4,0x35,0x24,0x75,0xbc,0xff,0xce,0x31,0x40,0xda,0xe5 },//== 19GpszRNUej5yYqxXoLnbZWKew3KdVLkXg#145
{ 0x03,0x13,0x78,0x07,0x79,0x0e,0xa7,0xdc,0x6e,0x97,0x90,0x1c,0x2b,0xc8,0x74,0x11,0xf4,0x5e,0xd7,0x4a,0x56,0x29,0x31,0x5c,0x4e,0x4b,0x03,0xa0,0xa1,0x02,0x25,0x0c,0x49 },//== 1MUJSJYtGPVGkBCTqGspnxyHahpt5Te8jy#150
{ 0x03,0x5c,0xd1,0x85,0x4c,0xae,0x45,0x39,0x1c,0xa4,0xec,0x42,0x8c,0xc7,0xe6,0xc7,0xd9,0x98,0x44,0x24,0xb9,0x54,0x20,0x9a,0x8e,0xea,0x19,0x7b,0x9e,0x36,0x4c,0x05,0xf6 },//== 1AoeP37TmHdFh8uN72fu9AqgtLrUwcv2wJ#155
{ 0x02,0xe0,0xa8,0xb0,0x39,0x28,0x2f,0xaf,0x6f,0xe0,0xfd,0x76,0x9c,0xfb,0xc4,0xb6,0xb4,0xcf,0x87,0x58,0xba,0x68,0x22,0x0e,0xac,0x42,0x0e,0x32,0xb9,0x1d,0xdf,0xa6,0x73 },//== 1NBC8uXJy1GiJ6drkiZa1WuKn51ps7EPTv#160
{ 0x02,0x5f,0x86,0x4e,0x8c,0xa1,0xe1,0x5a,0x54,0x1e,0xfa,0x6a,0x65,0x9b,0x4a,0x6e,0xb1,0xe3,0xab,0x4a,0xe8,0xeb,0x80,0xcf,0x7f,0x0b,0xdc,0xad,0xfb,0x16,0x52,0x5b,0x18 },//== 1PvaqLqRAivje7CactLR55xQBYvBeaDrXN
};

typedef struct hashtable_entry {
    uint32_t x2;
    uint32_t x3;
    uint32_t exponent;
} hashtable_entry;

#define HASH_SIZE (2*GSTEP)
hashtable_entry table[HASH_SIZE];
secp256k1_ge pubkeys[NUMPUBKEYS];

int main(int argc, char **argv) {
    secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);

    int next = 0;
    
    for (int i = 0; i < NUMPUBKEYS; i++) {
        if (!secp256k1_eckey_pubkey_parse(&pubkeys[i], rawpubkeys[i], 33)) {
            printf("Unparsable pubkey %2d\n", i);
            return -1;
        }
    }

    printf("Check bit = %d only, pubkey is:\n",CHECK_BITS);
    for(uint32_t i= 0;i<33;i++)
      printf("%02x",rawpubkeys[CHECK_BITS/5 - 17][i]);
    printf("\n");
      

    int shift_gmax;
    shift_gmax = CHECK_BITS - MEM_SIZE*2 -1;
    if(shift_gmax <0 ){
       printf("Error, CHECK_BITS too small =%d, should >= %d\n",CHECK_BITS, MEM_SIZE*2 +1);
       return 1;
    }

    unsigned int skip_bits;
    skip_bits = CHECK_BITS - MEM_SIZE -2;
    //printf("skip bits %d\n",skip_bits);

    uint64_t skip;
    uint64_t g_max;
    skip  = (uint64_t)0x1 << skip_bits;
    g_max = ((uint64_t)0x1 << shift_gmax)* (uint64_t)(GSTEP);
    //printf("skip %016lx gmax %016lx\n",skip,g_max);

    uint128_t rstart,rend;
    uint64_t start_hi,start_lo;
    uint64_t end_hi,end_lo;

    rstart   = (uint128_t)skip *(uint128_t)(HASH_SIZE);
    rend     = (uint128_t)g_max*(uint128_t)(HASH_SIZE)-1;
    start_lo = rstart;
    start_hi = rstart>>64;
    end_lo   = rend;
    end_hi   = rend>>64;

    uint64_t one_table_bytes;
    one_table_bytes = (uint64_t)&table[1] - (uint64_t)&table[0];

    printf("Build Hash, MEM size = %dGB\n", (uint32_t)(HASH_SIZE*one_table_bytes>>30));
    secp256k1_gej pt;
    secp256k1_gej_set_ge(&pt, &secp256k1_ge_const_g);
    for (uint64_t i = 1; i < GSTEP; i++) {
        secp256k1_fe x,zinv;
        secp256k1_fe_storage xst;

        secp256k1_fe_inv_var(&zinv, &pt.z);
        secp256k1_fe_sqr(&zinv, &zinv);
        secp256k1_fe_mul(&x, &pt.x, &zinv);
        secp256k1_fe_to_storage(&xst, &x);
        uint32_t entry = xst.n[0] & (HASH_SIZE-1);
        while (table[entry].exponent != 0) {
            entry = (entry + (xst.n[1] | 1)) & (HASH_SIZE - 1);
        }
        table[entry].exponent = i;
        table[entry].x2 = (uint32_t)xst.n[2];
        table[entry].x3 = (uint32_t)xst.n[3];
        secp256k1_gej_add_ge_var(&pt, &pt, &secp256k1_ge_const_g, NULL);
    }

    secp256k1_ge ptgstep;
    secp256k1_gej_neg(&pt, &pt);
    secp256k1_gej_double_var(&pt, &pt, NULL);


    secp256k1_ge_set_gej(&ptgstep, &pt);

    //secp256k1_gej_set_infinity(&pt);
    

    printf("Search bits = %d\n",CHECK_BITS);
    //skip some point by power of 2, we dont care 0 to start point
    //TODO update to random postion in a region
    for (uint64_t i = 0; i < skip_bits; i+=1) {
      secp256k1_gej_double_var(&pt, &pt, NULL);
    }

    printf("Search Keys....  from %lx%016lx to %lx%016lx\n",start_hi,start_lo, end_hi,end_lo);
    for (uint64_t i = skip; i < g_max; i++) {

//        for (int j = next; j < NUMPUBKEYS; j++) {
            secp256k1_gej diff;
            secp256k1_fe x,zinv;
            secp256k1_fe_storage xst;

            secp256k1_gej_add_ge_var(&diff, &pt, &pubkeys[CHECK_BITS/5 - 17], NULL);//check
            secp256k1_fe_inv_var(&zinv, &diff.z);
            secp256k1_fe_sqr(&zinv, &zinv);
            secp256k1_fe_mul(&x, &diff.x, &zinv);
            secp256k1_fe_to_storage(&xst, &x);


            uint32_t entry = xst.n[0] & (HASH_SIZE-1);
            while (table[entry].exponent != 0) {
                //if (table[entry].x == (uint32_t) xst.n[2]) {
                if ((table[entry].x2 == (uint32_t)xst.n[2]) && (table[entry].x3 == (uint32_t)xst.n[3])) {

                    uint128_t key = (uint128_t) i *  (uint128_t) (2 * GSTEP);

                    uint128_t key1 = key - table[entry].exponent ;
                    uint128_t key2 = key + table[entry].exponent;

   uint64_t key1lo = key1;
   uint64_t key1hi = (key1 >> 64);
   uint64_t key2lo = key2;
   uint64_t key2hi = (key2 >> 64);
                    printf("Found private key %2d: %lx%016lx or %lx%016lx\n", CHECK_BITS,  key1hi,key1lo,key2hi,key2lo);

                    FILE *fp = fopen("key.log","a+");
//                    fprintf(fp,"Found private, i=%16lx, x 2 x %16lx, exp=%x\n",(uint64_t)i,GSTEP,table[entry].exponent);
                    fprintf(fp,"Found private key %2d: %lx%016lx or %lx%016lx\n", CHECK_BITS,  key1hi,key1lo,key2hi,key2lo);
                    fclose(fp);
 
//                    next++;
                    //if (next == NUMPUBKEYS)
                        return 0;
                }        
                entry = (entry + (xst.n[1] | 1)) & (HASH_SIZE - 1);
            }
         //   if (j == next)
         //       break;
        //}
        //
        secp256k1_gej_add_ge_var(&pt, &pt, &ptgstep, NULL);
    }
    return 0;
}



May I PM you? 
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 [49] 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ... 261 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!