This commit is contained in:
Warlock-Dalbaeb 2017-08-15 00:59:39 +07:00
parent fef86629fa
commit 06f7eab4c6
2 changed files with 10 additions and 10 deletions

View file

@ -14,11 +14,11 @@
static std::mutex thread_mutex; static std::mutex thread_mutex;
static i2p::data::SigningKeyType type; static i2p::data::SigningKeyType type;
//static i2p::data::PrivateKeys keys; //static i2p::data::PrivateKeys keys;
static bool finded=false; static bool found=false;
static size_t MutateByte; static size_t MutateByte;
static uint32_t FindedNonce=0; static uint32_t FoundNonce=0;
static uint8_t * KeyBuf; static uint8_t * KeyBuf;

View file

@ -83,7 +83,7 @@ Orignal is sensei of crypto ;)
uint8_t hash[32]; uint8_t hash[32];
char addr[53]; char addr[53];
while(throughput-- and !finded){ while(throughput-- and !found){
memcpy (&ctx1, &ctx, sizeof (SHA256_CTX)); memcpy (&ctx1, &ctx, sizeof (SHA256_CTX));
SHA256_Update(&ctx1, b + MutateByte, 71); SHA256_Update(&ctx1, b + MutateByte, 71);
@ -93,14 +93,14 @@ Orignal is sensei of crypto ;)
if( !NotThat(addr,prefix) ){ if( !NotThat(addr,prefix) ){
ByteStreamToBase32 (hash, 32, addr, 52); ByteStreamToBase32 (hash, 32, addr, 52);
std::cout << "Address found " << addr << " in " << id_thread << std::endl; std::cout << "Address found " << addr << " in " << id_thread << std::endl;
finded=true; found=true;
FindedNonce=*nonce; FoundNonce=*nonce;
return true; return true;
} }
(*nonce)++; (*nonce)++;
hashescounter++; hashescounter++;
if (finded) break; if (found) break;
}//while }//while
} }
@ -193,7 +193,7 @@ if(type != i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519){
unsigned short attempts = 0; unsigned short attempts = 0;
while(!finded) while(!found)
{//while {//while
{//stack(for destructors(vector/thread)) {//stack(for destructors(vector/thread))
@ -209,15 +209,15 @@ while(!finded)
for(unsigned int j = 0; j < count_cpu;j++) for(unsigned int j = 0; j < count_cpu;j++)
threads[j].join(); threads[j].join();
if(FindedNonce == 0){ if(FoundNonce == 0){
RAND_bytes( KeyBuf+256 , 90 ); RAND_bytes( KeyBuf+MutateByte , 90 );
std::cout << "Attempts #" << ++attempts << std::endl; std::cout << "Attempts #" << ++attempts << std::endl;
} }
}//stack }//stack
}//while }//while
memcpy (KeyBuf + MutateByte, &FindedNonce, 4); memcpy (KeyBuf + MutateByte, &FoundNonce, 4);
std::cout << "Hashes: " << hashescounter << std::endl; std::cout << "Hashes: " << hashescounter << std::endl;
std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out); std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out);