Browse Source

Merge pull request #57 from wipedlife/master

Grammar Nazi. Delete not exist option.
darwin_fixes
orignal 7 years ago committed by GitHub
parent
commit
3b47f38bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      README.md
  2. 38
      vanitygen.cpp

21
README.md

@ -17,14 +17,27 @@ Notice: git submodules are used so make sure to clone this repository recursivel
* libssl * libssl
```bash ```bash
sudo apt-get install \
libboost-chrono-dev \ depend="libboost-chrono-dev \
libboost-date-time-dev \ libboost-date-time-dev \
libboost-filesystem-dev \ libboost-filesystem-dev \
libboost-program-options-dev \ libboost-program-options-dev \
libboost-system-dev \ libboost-system-dev \
libboost-thread-dev \ libboost-thread-dev \
libssl-dev libssl-dev"
kernel=`uname -a`
case "$kernel" in
*ubuntu*)
sudo apt install $depend;;
*debian*)
sudo aptitude install $depend;;
*gentoo*)
sudo emerge --deep --newuse dev-libs/boost dev-libs/openssl;;
*)
echo "Just install libboost and libopenssl dev packages on your pc";;
esac
``` ```
### Building ### Building
@ -84,7 +97,7 @@ Vanity generation adress.
#### Usage #### Usage
./vain privatekey.dat prefix <threads> <signature> ./vain --usage
#### Time to Generate on a 2.70GHz Processor #### Time to Generate on a 2.70GHz Processor
| characters| time to generate (approx.) | | characters| time to generate (approx.) |

38
vanitygen.cpp

@ -1,5 +1,5 @@
#include "vanity.hpp" #include "vanity.hpp"
#include<regex.h> #include<regex>
#include<getopt.h> #include<getopt.h>
@ -8,7 +8,7 @@ static struct{
int threads=-1; int threads=-1;
i2p::data::SigningKeyType signature; i2p::data::SigningKeyType signature;
std::string outputpath=""; std::string outputpath="";
regex_t regex; std::regex regex;
}options; }options;
@ -112,17 +112,12 @@ static inline size_t ByteStreamToBase32 (const uint8_t * inBuf, size_t len, char
return ret; return ret;
} }
static inline bool NotThat(const char * what, const regex_t * reg){ static inline bool NotThat(const char * what, const std::regex & reg){
int ret = regexec(reg, what, 0, 0, 0); return std::regex_match(what,reg) == 1 ? false : true;
if( ret == REG_NOMATCH ) return true;
else if(ret == 0) return false;
std::cerr << "Some error in regexping" << std::endl;
exit(2);
} }
static inline bool NotThat(const char * a, const char *b) static inline bool NotThat(const char * a, const char *b)
{ {
while(*b) while(*b)
if(*a++!=*b++) if(*a++!=*b++)
return true; return true;
@ -188,7 +183,7 @@ Orignal is sensei of crypto ;)
//bool result = options.reg ? !NotThat(addr, &options.regex) : !NotThat(addr,prefix); //bool result = options.reg ? !NotThat(addr, &options.regex) : !NotThat(addr,prefix);
if( ( options.reg ? !NotThat(addr, &options.regex) : !NotThat(addr,prefix) ) ) if( ( options.reg ? !NotThat(addr, options.regex) : !NotThat(addr,prefix) ) )
// if(result) // if(result)
{ {
ByteStreamToBase32 ((uint8_t*)hash, 32, addr, 52); ByteStreamToBase32 ((uint8_t*)hash, 32, addr, 52);
@ -217,15 +212,15 @@ Orignal is sensei of crypto ;)
void usaging(void){ void usage(void){
const constexpr char * help="vain pattern [options]\n" const constexpr char * help="vain pattern [options]\n"
"-h --help help menu\n" "-h --help help menu\n"
"-r --reg regexp instead just text pattern\n" "-r --reg regexp instead just text pattern\n"
"--threads -t (default count of system)\n" "--threads -t (default count of system)\n"
"--signature -s (signature type)\n" "--signature -s (signature type)\n"
"-o --output output file(default private.dat)\n" "-o --output output file(default private.dat)\n"
"--usage usaging\n" "--usage usage\n"
"--prefix -p\n" //"--prefix -p\n"
""; "";
puts(help); puts(help);
} }
@ -248,11 +243,11 @@ void parsing(int argc, char ** args){
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") ){
usaging(); usage();
exit(1); exit(1);
} }
case 'h': case 'h':
usaging(); usage();
exit(0); exit(0);
break; break;
case 'r': case 'r':
@ -285,7 +280,7 @@ int main (int argc, char * argv[])
if ( argc < 2 ) if ( argc < 2 )
{ {
usaging(); usage();
return 0; return 0;
} }
parsing( argc > 2 ? argc-1 : argc, argc > 2 ? argv+1 : argv); parsing( argc > 2 ? argc-1 : argc, argc > 2 ? argv+1 : argv);
@ -295,11 +290,12 @@ int main (int argc, char * argv[])
std::cout << "Not correct prefix(just string)" << std::endl; std::cout << "Not correct prefix(just string)" << std::endl;
return 1; return 1;
}else{ }else{
int ret = regcomp( &options.regex, argv[1], REG_EXTENDED ); options.regex=std::regex(argv[1]);
if( ret != 0 ){ // int ret = regcomp( &options.regex, argv[1], REG_EXTENDED );
std::cerr << "Can't create regexp pattern from " << argv[1] << std::endl; // if( ret != 0 ){
return 1; // std::cerr << "Can't create regexp pattern from " << argv[1] << std::endl;
} // return 1;
// }
} }
i2p::crypto::InitCrypto (false); i2p::crypto::InitCrypto (false);

Loading…
Cancel
Save