From 263809be18ceaa566e89c4c2c72913c8155c14e1 Mon Sep 17 00:00:00 2001 From: acetone <63557806+acetoneRu@users.noreply.github.com> Date: Thu, 3 Jun 2021 00:34:30 -0400 Subject: [PATCH 1/8] RED25519-SHA512 added to README also pasted link to docs --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 1f0c4b4..d3e8d05 100755 --- a/README.md +++ b/README.md @@ -76,6 +76,9 @@ or | EDDSA-SHA512-ED25519 | 7 | | GOSTR3410_CRYPTO_PRO_A-GOSTR3411-256 | 9 | | GOSTR3410_TC26_A_512-GOSTR3411-512 | 10 | +| RED25519-SHA512 | 11 | + +For more information on the types of signatures, see the [documentation](https://i2pd.readthedocs.io/en/latest/user-guide/tunnels/#signature-types). ### vain From 9618b2093903cd306943b6cc1113dda8a78037d1 Mon Sep 17 00:00:00 2001 From: acetoneRu Date: Thu, 3 Jun 2021 00:56:35 -0400 Subject: [PATCH 2/8] keygen in user friendly mode --- keygen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keygen.cpp b/keygen.cpp index 9105d92..81d184c 100644 --- a/keygen.cpp +++ b/keygen.cpp @@ -17,6 +17,7 @@ int main (int argc, char * argv[]) if (argc > 2) { std::string str(argv[2]); type = NameToSigType(str); + if (SigTypeToName(type).find("unknown") != std::string::npos) { std::cerr << "Incorrect signature type" << std::endl; return -2; } } auto keys = i2p::data::PrivateKeys::CreateRandomKeys (type); std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out); @@ -28,6 +29,7 @@ int main (int argc, char * argv[]) f.write ((char *)buf, len); delete[] buf; std::cout << "Destination " << keys.GetPublic ()->GetIdentHash ().ToBase32 () << " created" << std::endl; + std::cout << "Signature type: " << SigTypeToName(type) << " (" << type << ")" << std::endl; } else std::cout << "Can't create file " << argv[1] << std::endl; From 3f59de5e733220c06008e11982196d01202dee62 Mon Sep 17 00:00:00 2001 From: acetoneRu Date: Thu, 3 Jun 2021 01:33:13 -0400 Subject: [PATCH 3/8] vanitygen output formatted with mutex --- vanitygen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vanitygen.cpp b/vanitygen.cpp index 982d09d..883284e 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -1,6 +1,7 @@ #include "vanity.hpp" -#include -#include +#include +#include +#include static struct @@ -124,6 +125,7 @@ static inline bool NotThat(const char * a, const char *b) return false; } +std::mutex mtx; static inline bool thread_find(uint8_t * buf, const char * prefix, int id_thread, unsigned long long throughput) { /** @@ -131,7 +133,9 @@ static inline bool thread_find(uint8_t * buf, const char * prefix, int id_thread * For idea and example ^-^ * Orignal is sensei of crypto ;) */ + mtx.lock(); std::cout << "Thread " << id_thread << " binded" << std::endl; + mtx.unlock(); /* union { From 24e127f561d721964daadd172e995e5ba9f7ae2c Mon Sep 17 00:00:00 2001 From: acetoneRu Date: Thu, 3 Jun 2021 02:09:22 -0400 Subject: [PATCH 4/8] gen: signature choice deleted --- vanitygen.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/vanitygen.cpp b/vanitygen.cpp index 883284e..81ee356 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -11,8 +11,17 @@ static struct i2p::data::SigningKeyType signature; std::string outputpath=""; std::regex regex; + bool sig_type = true; } options; +void check_sig_type() +{ + if (SigTypeToName(options.signature).find("unknown") != std::string::npos) + { + std::cerr << "Incorrect signature type" << std::endl; + options.sig_type = false; + } +} static void inline CalculateW (const uint8_t block[64], uint32_t W[64]) { @@ -214,13 +223,12 @@ static inline bool thread_find(uint8_t * buf, const char * prefix, int id_thread void usage(void){ const constexpr char * help="vain [text-pattern|regex-pattern] [options]\n" - "-h --help, help menu\n" - "-r --reg, regexp instead just text pattern (e.g. '(one|two).*')\n" - "--threads -t, (default count of system)\n" - "--signature -s, (signature type)\n" - "-o --output output file (default private.dat)\n" - "--usage usage\n" - // "--prefix -p\n" + "-h --help help menu\n" + "-r --reg regexp instead just text pattern (e.g. '(one|two).*')\n" + "-t --threads (default count of system)\n" +// "--signature -s, (signature type)\n" NOT IMPLEMENTED FUCKING PLAZ! + "-o --output output file (default private.dat)\n" + "--usage usage\n" ""; puts(help); } @@ -257,6 +265,7 @@ void parsing(int argc, char ** args){ break; case 's': options.signature = NameToSigType(std::string(optarg)); + check_sig_type(); break; case 'o': options.outputpath=optarg; @@ -306,6 +315,7 @@ int main (int argc, char * argv[]) /////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + if (!options.sig_type) return -2; auto keys = i2p::data::PrivateKeys::CreateRandomKeys (options.signature); switch(options.signature) { @@ -315,7 +325,7 @@ int main (int argc, char * argv[]) case i2p::data::SIGNING_KEY_TYPE_RSA_SHA384_3072: case i2p::data::SIGNING_KEY_TYPE_RSA_SHA512_4096: case i2p::data::SIGNING_KEY_TYPE_GOSTR3410_TC26_A_512_GOSTR3411_512: - std::cout << "Sorry, i don't can generate address for this signature type" << std::endl; + std::cout << "Sorry, I don't can generate address for this signature type" << std::endl; return 0; break; } From 4d89abf0af7d4cffe82da61362d1d94c18de7816 Mon Sep 17 00:00:00 2001 From: acetoneRu Date: Thu, 3 Jun 2021 02:53:30 -0400 Subject: [PATCH 5/8] id_thread is not needed for user output --- vanitygen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vanitygen.cpp b/vanitygen.cpp index 81ee356..1dbd240 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -200,7 +200,7 @@ static inline bool thread_find(uint8_t * buf, const char * prefix, int id_thread // if(result) { ByteStreamToBase32 ((uint8_t*)hash, 32, addr, 52); - std::cout << "Address found " << addr << " in " << id_thread << std::endl; + std::cout << "Address found " << addr << std::endl; found=true; FoundNonce=*nonce; // free(hash); From d888825470eba84640769a5c2b66dede99707247 Mon Sep 17 00:00:00 2001 From: acetoneRu Date: Thu, 3 Jun 2021 03:10:56 -0400 Subject: [PATCH 6/8] --usage deleted because --help and -h already exist --- vanitygen.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/vanitygen.cpp b/vanitygen.cpp index 1dbd240..5030ec1 100644 --- a/vanitygen.cpp +++ b/vanitygen.cpp @@ -228,7 +228,6 @@ void usage(void){ "-t --threads (default count of system)\n" // "--signature -s, (signature type)\n" NOT IMPLEMENTED FUCKING PLAZ! "-o --output output file (default private.dat)\n" - "--usage usage\n" ""; puts(help); } From 56b8d02a975464f915d25d80f7cde44626f28897 Mon Sep 17 00:00:00 2001 From: acetone <63557806+acetoneRu@users.noreply.github.com> Date: Thu, 3 Jun 2021 03:45:27 -0400 Subject: [PATCH 7/8] keyinfo tool description corrected --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d3e8d05..e460faf 100755 --- a/README.md +++ b/README.md @@ -91,17 +91,17 @@ Vanity generation address. #### Time to Generate on a 2.70GHz Processor | characters| time to generate (approx.) | | -------------------- | --------------- | -| 1 | ~0.082s | -| 2 | ~0.075s | -| 3 | ~0.100s | -| 4 | ~0.394s | -| 5 | ~6.343s | -| 6 | ~1m-5m | -| 7 | ~30m | +| 1 | ~0.082s | +| 2 | ~0.075s | +| 3 | ~0.100s | +| 4 | ~0.394s | +| 5 | ~6.343s | +| 6 | ~1m-5m | +| 7 | ~30m | ### keyinfo -Prints information about an i2p private key +Prints information about an i2p keys #### Usage From 31452d924dbb73b64b2d9b294f125092edc294ed Mon Sep 17 00:00:00 2001 From: acetone <63557806+acetoneRu@users.noreply.github.com> Date: Thu, 3 Jun 2021 03:54:28 -0400 Subject: [PATCH 8/8] i2p -> I2P --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e460faf..3a55aa1 100755 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ print iptables firewall rules to allow 1 nodes in netdb through firewall includi ### keygen -Generate an i2p private key +Generate an I2P private key #### Usage @@ -101,7 +101,7 @@ Vanity generation address. ### keyinfo -Prints information about an i2p keys +Prints information about an I2P private key #### Usage