From 06f7eab4c6401e2117943a7e688807938e4ecd8e Mon Sep 17 00:00:00 2001 From: Warlock-Dalbaeb Date: Tue, 15 Aug 2017 00:59:39 +0700 Subject: [PATCH 1/3] lang --- vanity.hpp | 4 ++-- vanitygen.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/vanity.hpp b/vanity.hpp index 09910c2..b1032a2 100644 --- a/vanity.hpp +++ b/vanity.hpp @@ -14,11 +14,11 @@ static std::mutex thread_mutex; static i2p::data::SigningKeyType type; //static i2p::data::PrivateKeys keys; -static bool finded=false; +static bool found=false; static size_t MutateByte; -static uint32_t FindedNonce=0; +static uint32_t FoundNonce=0; static uint8_t * KeyBuf; diff --git a/vanitygen.cpp b/vanitygen.cpp index bb60d6b..3f351ce 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -83,7 +83,7 @@ Orignal is sensei of crypto ;) uint8_t hash[32]; char addr[53]; - while(throughput-- and !finded){ + while(throughput-- and !found){ memcpy (&ctx1, &ctx, sizeof (SHA256_CTX)); SHA256_Update(&ctx1, b + MutateByte, 71); @@ -93,14 +93,14 @@ Orignal is sensei of crypto ;) if( !NotThat(addr,prefix) ){ ByteStreamToBase32 (hash, 32, addr, 52); std::cout << "Address found " << addr << " in " << id_thread << std::endl; - finded=true; - FindedNonce=*nonce; + found=true; + FoundNonce=*nonce; return true; } (*nonce)++; hashescounter++; - if (finded) break; + if (found) break; }//while } @@ -193,7 +193,7 @@ if(type != i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519){ unsigned short attempts = 0; -while(!finded) +while(!found) {//while {//stack(for destructors(vector/thread)) @@ -209,15 +209,15 @@ while(!finded) for(unsigned int j = 0; j < count_cpu;j++) threads[j].join(); - if(FindedNonce == 0){ - RAND_bytes( KeyBuf+256 , 90 ); + if(FoundNonce == 0){ + RAND_bytes( KeyBuf+MutateByte , 90 ); std::cout << "Attempts #" << ++attempts << std::endl; } }//stack }//while - memcpy (KeyBuf + MutateByte, &FindedNonce, 4); + memcpy (KeyBuf + MutateByte, &FoundNonce, 4); std::cout << "Hashes: " << hashescounter << std::endl; std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out); From a65bd8fbaf2f2e609cb23aca20046f3e9e55d11d Mon Sep 17 00:00:00 2001 From: Warlock-Dalbaeb Date: Tue, 15 Aug 2017 01:03:17 +0700 Subject: [PATCH 2/3] vanity --- vanity.hpp | 10 ++++++++-- vanitygen.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/vanity.hpp b/vanity.hpp index b1032a2..619c6c8 100644 --- a/vanity.hpp +++ b/vanity.hpp @@ -11,6 +11,9 @@ #include #include + + + static std::mutex thread_mutex; static i2p::data::SigningKeyType type; //static i2p::data::PrivateKeys keys; @@ -24,5 +27,8 @@ static uint8_t * KeyBuf; //static uint8_t * PaddingBuf; static unsigned long long hashescounter; -unsigned short count_cpu __attribute__((__mode__(QI))); // 1 byte - +#ifdef MODES +unsigned short count_cpu __attribute__((__mode__(QI))); // 1 byte i think don't usefful +#else +unsigned short count_cpu; +#endif diff --git a/vanitygen.cpp b/vanitygen.cpp index 3f351ce..e6219fd 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -67,8 +67,11 @@ For idea and example ^-^ Orignal is sensei of crypto ;) */ std::cout << "Thread " << id_thread << " binded" << std::endl; - - uint8_t b[391]; __attribute__((__mode__(SI))); // 4 byte == 32 bits, not usefull. i think. +#ifdef MODES + uint8_t b[391] __attribute__((__mode__(SI))); // 4 byte == 32 bits, not usefull. i think. +#else + uint8_t b[391]; +#endif memcpy (b, buf, 391); int len = strlen (prefix); From 827819e8a6bc798291acad20845a8c984168e63b Mon Sep 17 00:00:00 2001 From: Warlock-Dalbaeb Date: Tue, 15 Aug 2017 01:05:04 +0700 Subject: [PATCH 3/3] vanity --- vanity.hpp | 1 + vanitygen.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/vanity.hpp b/vanity.hpp index 619c6c8..e3f758f 100644 --- a/vanity.hpp +++ b/vanity.hpp @@ -13,6 +13,7 @@ +#define MODES static std::mutex thread_mutex; static i2p::data::SigningKeyType type; diff --git a/vanitygen.cpp b/vanitygen.cpp index e6219fd..8d91e36 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -237,3 +237,5 @@ while(!found) return 0; } +#undef MODES +