From 8a3d610abb419f922172240714c99fce8e18fc2d Mon Sep 17 00:00:00 2001 From: Warlock-Dalbaeb Date: Wed, 9 Aug 2017 05:40:42 +0700 Subject: [PATCH 1/2] notes --- vanitygen.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vanitygen.cpp b/vanitygen.cpp index 9ce9225..a84987f 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -22,7 +22,6 @@ static unsigned long long hash; #ifdef CPU_ONLY -// XXX: make this faster static inline bool NotThat(const char * a, const char *b){ while(*b) if(*a++!=*b++) return true; @@ -30,7 +29,9 @@ return false; } inline void twist_cpu(uint8_t * buf,size_t * l0){ -//TODO: NORMAL IMPLEMENTATION +//TODO: NORMAL IMPLEMENTATION,\ +As in miner... + RAND_bytes(buf,padding_size); } @@ -112,6 +113,12 @@ int main (int argc, char * argv[]) } // TODO: multi threading +/* +TODO: + Francezgy переделай пожалуйста треды + без всех это pthread + * orignal has quit (Quit: Leaving) +*/ KeyBuf = new uint8_t[keys.GetFullLen()]; PaddingBuf = keys.GetPadding(); unsigned int count_cpu = sysconf(_SC_NPROCESSORS_ONLN); From 2b1f950d4bed8319c501f6f0da06925fce656828 Mon Sep 17 00:00:00 2001 From: Warlock-Dalbaeb Date: Wed, 9 Aug 2017 05:52:09 +0700 Subject: [PATCH 2/2] prefix --- vanitygen.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vanitygen.cpp b/vanitygen.cpp index a84987f..c2968b0 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -19,7 +19,25 @@ static uint8_t * PaddingBuf; static unsigned long long hash; #define CPU_ONLY +static bool check_prefix(const char * buf){ +unsigned short size_str=0; +while(*buf) +{ + if( + *buf < 48 + || + (*buf > 57 && *buf < 65) + || + (*buf > 64 && *buf < 94) + || *buf > 125 + || size_str > 52 + )return false; +size_str++; +*buf++; +} +return true; +} #ifdef CPU_ONLY static inline bool NotThat(const char * a, const char *b){ @@ -66,6 +84,10 @@ int main (int argc, char * argv[]) std::cout << "Usage: " << argv[0] << " filename generatestring " << std::endl; return 0; } + if(!check_prefix(argv[2])){ + std::cout << "Not correct prefix" << std::endl; + return 0; + } i2p::crypto::InitCrypto (false); type = i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519; if ( argc > 3 )