From 3f64d30a79aa882f9b4b284c41dd58e8ec9b5858 Mon Sep 17 00:00:00 2001 From: wipedlife Date: Tue, 12 Jun 2018 00:21:45 +0700 Subject: [PATCH 1/4] README update --- README.md | 2 +- vanitygen.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7758c27..fe4821a 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Vanity generation adress. #### Usage -./vain privatekey.dat prefix +./vain --usage #### Time to Generate on a 2.70GHz Processor | characters| time to generate (approx.) | diff --git a/vanitygen.cpp b/vanitygen.cpp index 330a4f3..0c1cb62 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -225,7 +225,7 @@ void usaging(void){ "--signature -s (signature type)\n" "-o --output output file(default private.dat)\n" "--usage usaging\n" - "--prefix -p\n" + //"--prefix -p\n" ""; puts(help); } From c275332df0ebdc887233f3b0eebce8623bf0b2c7 Mon Sep 17 00:00:00 2001 From: wipedlife Date: Tue, 12 Jun 2018 00:24:37 +0700 Subject: [PATCH 2/4] grammar nazi --- vanitygen.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vanitygen.cpp b/vanitygen.cpp index 0c1cb62..a178951 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -217,14 +217,14 @@ Orignal is sensei of crypto ;) -void usaging(void){ +void usage(void){ const constexpr char * help="vain pattern [options]\n" "-h --help help menu\n" "-r --reg regexp instead just text pattern\n" "--threads -t (default count of system)\n" "--signature -s (signature type)\n" "-o --output output file(default private.dat)\n" - "--usage usaging\n" + "--usage usage\n" //"--prefix -p\n" ""; puts(help); @@ -248,11 +248,11 @@ void parsing(int argc, char ** args){ switch(c){ case 0: if ( std::string(long_options[option_index].name) == std::string("usage") ){ - usaging(); + usage(); exit(1); } case 'h': - usaging(); + usage(); exit(0); break; case 'r': @@ -285,7 +285,7 @@ int main (int argc, char * argv[]) if ( argc < 2 ) { - usaging(); + usage(); return 0; } parsing( argc > 2 ? argc-1 : argc, argc > 2 ? argv+1 : argv); From 3c7e4d31e96a4c2fdc0507681a5d011b737fb6c0 Mon Sep 17 00:00:00 2001 From: wipedlife Date: Tue, 12 Jun 2018 01:00:59 +0700 Subject: [PATCH 3/4] readme --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe4821a..2e98330 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,27 @@ Notice: git submodules are used so make sure to clone this repository recursivel * libssl ```bash -sudo apt-get install \ - libboost-chrono-dev \ + +depend="libboost-chrono-dev \ libboost-date-time-dev \ libboost-filesystem-dev \ libboost-program-options-dev \ libboost-system-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 From 88adabda6c13497490884bfd32843666bbc5ca0a Mon Sep 17 00:00:00 2001 From: wipedlife Date: Wed, 13 Jun 2018 10:50:51 +0700 Subject: [PATCH 4/4] cxx regex --- vanitygen.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/vanitygen.cpp b/vanitygen.cpp index a178951..3c41631 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -1,5 +1,5 @@ #include "vanity.hpp" -#include +#include #include @@ -8,7 +8,7 @@ static struct{ int threads=-1; i2p::data::SigningKeyType signature; std::string outputpath=""; - regex_t regex; + std::regex regex; }options; @@ -112,17 +112,12 @@ static inline size_t ByteStreamToBase32 (const uint8_t * inBuf, size_t len, char return ret; } -static inline bool NotThat(const char * what, const regex_t * reg){ - int ret = regexec(reg, what, 0, 0, 0); - 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 * what, const std::regex & reg){ + return std::regex_match(what,reg) == 1 ? false : true; } static inline bool NotThat(const char * a, const char *b) { - while(*b) if(*a++!=*b++) return true; @@ -188,7 +183,7 @@ Orignal is sensei of crypto ;) //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) { ByteStreamToBase32 ((uint8_t*)hash, 32, addr, 52); @@ -295,11 +290,12 @@ int main (int argc, char * argv[]) std::cout << "Not correct prefix(just string)" << std::endl; return 1; }else{ - int ret = regcomp( &options.regex, argv[1], REG_EXTENDED ); - if( ret != 0 ){ - std::cerr << "Can't create regexp pattern from " << argv[1] << std::endl; - return 1; - } + options.regex=std::regex(argv[1]); +// int ret = regcomp( &options.regex, argv[1], REG_EXTENDED ); +// if( ret != 0 ){ +// std::cerr << "Can't create regexp pattern from " << argv[1] << std::endl; +// return 1; +// } } i2p::crypto::InitCrypto (false);