mirror of
https://github.com/PurpleI2P/i2pd-tools.git
synced 2025-01-22 21:37:18 +01:00
multiple search addresses
This commit is contained in:
parent
e0b0a3f9df
commit
3acfdccac3
55
vain.cpp
55
vain.cpp
|
@ -3,24 +3,10 @@
|
||||||
#include<getopt.h>
|
#include<getopt.h>
|
||||||
#include<string>
|
#include<string>
|
||||||
#include<boost/filesystem.hpp>
|
#include<boost/filesystem.hpp>
|
||||||
|
//#include<boost/algorithm/string/predicate.hpp>
|
||||||
//#include<format> // is not supports for me
|
//#include<format> // is not supports for me
|
||||||
|
|
||||||
/// Crypto InitCrypto. TODO: to makefile/another place get the macro
|
// some global vars in vanitygen.hpp
|
||||||
#ifndef PRECOMPUTATION_CRYPTO
|
|
||||||
#define PRECOMPUTATION_CRYPTO false
|
|
||||||
#endif
|
|
||||||
#ifndef AESNI_CRYPTO
|
|
||||||
#define AESNI_CRYPTO false
|
|
||||||
#endif
|
|
||||||
#ifndef AVX_CRYPTO
|
|
||||||
#define AVX_CRYPTO false
|
|
||||||
#endif
|
|
||||||
#ifndef FORCE_CRYPTO
|
|
||||||
#define FORCE_CRYPTO false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEF_OUT_FILE "private.dat"
|
|
||||||
|
|
||||||
static struct{
|
static struct{
|
||||||
bool reg=false;
|
bool reg=false;
|
||||||
int threads=-1;
|
int threads=-1;
|
||||||
|
@ -240,6 +226,7 @@ void usage(void){
|
||||||
"-o --output output file(default " DEF_OUT_FILE ")\n"
|
"-o --output output file(default " DEF_OUT_FILE ")\n"
|
||||||
//"--usage usage\n"
|
//"--usage usage\n"
|
||||||
//"--prefix -p\n"
|
//"--prefix -p\n"
|
||||||
|
"--multiplymode -m - multiple addresses search"
|
||||||
"";
|
"";
|
||||||
puts(help);
|
puts(help);
|
||||||
}
|
}
|
||||||
|
@ -253,18 +240,22 @@ void parsing(int argc, char ** args){
|
||||||
{"threads", required_argument, 0, 't'},
|
{"threads", required_argument, 0, 't'},
|
||||||
{"signature", required_argument,0,'s'},
|
{"signature", required_argument,0,'s'},
|
||||||
{"output", required_argument,0,'o'},
|
{"output", required_argument,0,'o'},
|
||||||
|
{"multiplymode", no_argument, 0, 'm'},
|
||||||
//{"usage", no_argument,0,0},
|
//{"usage", no_argument,0,0},
|
||||||
{0,0,0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while( (c=getopt_long(argc,args, "hrt:s:o:", long_options, &option_index))!=-1){
|
while( (c=getopt_long(argc,args, "hrt:s:o:m", long_options, &option_index))!=-1){
|
||||||
switch(c){
|
switch(c){
|
||||||
//case 0:
|
//case 0:
|
||||||
// if ( std::string(long_options[option_index].name) == std::string("usage") ){
|
// if ( std::string(long_options[option_index].name) == std::string("usage") ){
|
||||||
// usage();
|
// usage();
|
||||||
// exit(1);
|
// exit(1);
|
||||||
// }
|
// }
|
||||||
|
case 'm':
|
||||||
|
multipleSearchMode=true;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -357,6 +348,10 @@ int main (int argc, char * argv[])
|
||||||
if ( !std::regex_match( std::string(argv[1]), std::regex("[a-zA-Z0-9\\.]{1,}")) ) {
|
if ( !std::regex_match( std::string(argv[1]), std::regex("[a-zA-Z0-9\\.]{1,}")) ) {
|
||||||
std::cerr << "Please, change the outputfile name" << std::endl;
|
std::cerr << "Please, change the outputfile name" << std::endl;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
if ( options . outputpath . empty () ) options . outputpath . assign ( DEF_OUT_FILE ) ;
|
||||||
|
static std::string outPutFileName = options.outputpath;
|
||||||
|
auto doSearch = [argc,argv] () {
|
||||||
auto keys = i2p::data::PrivateKeys::CreateRandomKeys (options.signature);
|
auto keys = i2p::data::PrivateKeys::CreateRandomKeys (options.signature);
|
||||||
// IDK type, and don't want to check. so...
|
// IDK type, and don't want to check. so...
|
||||||
auto createDumpFile = [/*keys*/](std::string outFile, i2p::data::PrivateKeys keys){
|
auto createDumpFile = [/*keys*/](std::string outFile, i2p::data::PrivateKeys keys){
|
||||||
|
@ -388,7 +383,7 @@ int main (int argc, char * argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: for other types.
|
//TODO: for other types.
|
||||||
switch(options.signature)
|
switch(options.signature)
|
||||||
{
|
{
|
||||||
case i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256:
|
case i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256:
|
||||||
|
@ -409,13 +404,13 @@ int main (int argc, char * argv[])
|
||||||
case i2p::data::SIGNING_KEY_TYPE_GOSTR3410_CRYPTO_PRO_A_GOSTR3411_256:
|
case i2p::data::SIGNING_KEY_TYPE_GOSTR3410_CRYPTO_PRO_A_GOSTR3411_256:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// there we gen key to buffer. That we mem allocate...
|
// there we gen key to buffer. That we mem allocate...
|
||||||
KeyBuf = new uint8_t[keys.GetFullLen()];
|
KeyBuf = new uint8_t[keys.GetFullLen()];
|
||||||
keys.ToBuffer (KeyBuf, keys.GetFullLen ());
|
keys.ToBuffer (KeyBuf, keys.GetFullLen ());
|
||||||
/// there was some things for cpu 665% usage, but is not helpful even
|
/// there was some things for cpu 665% usage, but is not helpful even
|
||||||
std::cout << "Start vanity generator in " << options.threads << " threads" << std::endl;
|
std::cout << "Start vanity generator in " << options.threads << " threads" << std::endl;
|
||||||
// there we start to change byte in our private key. we can change another bytes too
|
// there we start to change byte in our private key. we can change another bytes too
|
||||||
// but we just change 1 byte in all key. So. TODO: change all bytes not one?
|
// but we just change 1 byte in all key. So. TODO: change all bytes not one?
|
||||||
unsigned short attempts = 0;// it can be disabled, it's just for a statistic. For CPU this is a trash?
|
unsigned short attempts = 0;// it can be disabled, it's just for a statistic. For CPU this is a trash?
|
||||||
while(!found)
|
while(!found)
|
||||||
{//while
|
{//while
|
||||||
|
@ -460,7 +455,10 @@ int main (int argc, char * argv[])
|
||||||
// IDK. what for acetone change this line to if (options.output...empty() ... assign
|
// IDK. what for acetone change this line to if (options.output...empty() ... assign
|
||||||
// cplusplus.com/reference/string/string/assign yes we can. but I would don't change this
|
// cplusplus.com/reference/string/string/assign yes we can. but I would don't change this
|
||||||
//if(options.outputpath.size() == 0) options.outputpath = DEF_OUT_FILE;
|
//if(options.outputpath.size() == 0) options.outputpath = DEF_OUT_FILE;
|
||||||
if ( options . outputpath . empty () ) options . outputpath . assign ( DEF_OUT_FILE ) ;
|
options.outputpath = options.outputpath + std::to_string(foundKeys) + std::string(".dat");
|
||||||
|
|
||||||
|
//if ( ! boost::algorithm::ends_with(options.outputpath, ".dat") )
|
||||||
|
// options.outputpath = options.outputpath + ".dat";
|
||||||
|
|
||||||
// there we generate a key, like as in keygen.cpp
|
// there we generate a key, like as in keygen.cpp
|
||||||
// before a mining we would to create a dump file
|
// before a mining we would to create a dump file
|
||||||
|
@ -477,8 +475,17 @@ int main (int argc, char * argv[])
|
||||||
else
|
else
|
||||||
std::cout << "Can't create file " << options.outputpath << std::endl;
|
std::cout << "Can't create file " << options.outputpath << std::endl;
|
||||||
|
|
||||||
i2p::crypto::TerminateCrypto ();
|
}; // void doSearch lamda
|
||||||
|
|
||||||
|
do {
|
||||||
|
doSearch();
|
||||||
|
foundKeys++;
|
||||||
|
options.outputpath.assign(outPutFileName);
|
||||||
|
found = false;
|
||||||
|
FoundNonce = 0;
|
||||||
|
} while(multipleSearchMode);
|
||||||
|
|
||||||
|
i2p::crypto::TerminateCrypto ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
vanity.hpp
21
vanity.hpp
|
@ -41,8 +41,27 @@
|
||||||
|
|
||||||
//static i2p::data::SigningKeyType type;
|
//static i2p::data::SigningKeyType type;
|
||||||
//static i2p::data::PrivateKeys keys;
|
//static i2p::data::PrivateKeys keys;
|
||||||
static bool found=false;
|
|
||||||
|
|
||||||
|
|
||||||
|
// for InitCrypto. TODO: to makefile/another place get the macro
|
||||||
|
#ifndef PRECOMPUTATION_CRYPTO
|
||||||
|
#define PRECOMPUTATION_CRYPTO false
|
||||||
|
#endif
|
||||||
|
#ifndef AESNI_CRYPTO
|
||||||
|
#define AESNI_CRYPTO false
|
||||||
|
#endif
|
||||||
|
#ifndef AVX_CRYPTO
|
||||||
|
#define AVX_CRYPTO false
|
||||||
|
#endif
|
||||||
|
#ifndef FORCE_CRYPTO
|
||||||
|
#define FORCE_CRYPTO false
|
||||||
|
#endif
|
||||||
|
// def out file name
|
||||||
|
#define DEF_OUT_FILE "private"
|
||||||
|
// Global vars
|
||||||
|
static bool found=false;
|
||||||
|
static bool multipleSearchMode = false;
|
||||||
|
static unsigned int foundKeys = 0;
|
||||||
static size_t MutateByte;
|
static size_t MutateByte;
|
||||||
|
|
||||||
static uint32_t FoundNonce=0;
|
static uint32_t FoundNonce=0;
|
||||||
|
|
Loading…
Reference in a new issue