Browse Source

Merge pull request #20 from SOUx4cx4fx56x69/master

Prefix check
pull/22/head
orignal 7 years ago committed by GitHub
parent
commit
70ecfc2259
  1. 33
      vanitygen.cpp

33
vanitygen.cpp

@ -19,10 +19,27 @@ static uint8_t * PaddingBuf; @@ -19,10 +19,27 @@ 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
// XXX: make this faster
static inline bool NotThat(const char * a, const char *b){
while(*b)
if(*a++!=*b++) return true;
@ -30,7 +47,9 @@ return false; @@ -30,7 +47,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);
}
@ -65,6 +84,10 @@ int main (int argc, char * argv[]) @@ -65,6 +84,10 @@ int main (int argc, char * argv[])
std::cout << "Usage: " << argv[0] << " filename generatestring <signature type>" << 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 )
@ -112,6 +135,12 @@ int main (int argc, char * argv[]) @@ -112,6 +135,12 @@ int main (int argc, char * argv[])
}
// TODO: multi threading
/*
TODO:
<orignal> Francezgy переделай пожалуйста треды
<orignal> без всех это pthread
* orignal has quit (Quit: Leaving)
*/
KeyBuf = new uint8_t[keys.GetFullLen()];
PaddingBuf = keys.GetPadding();
unsigned int count_cpu = sysconf(_SC_NPROCESSORS_ONLN);

Loading…
Cancel
Save