9 커밋 ffd909dcf9 ... 142c8b0c4d

작성자 SHA1 메시지 날짜
  potatowipedlifereverse 142c8b0c4d fix pairkey 4 년 전
  potatowipedlifereverse 866a203252 ncurses 4 년 전
  potatowipedlifereverse 85aff3f807 gtk-interface.c 4 년 전
  potatowipedlifereverse 021ac99ab4 gtk-interface 4 년 전
  potatowipedlifereverse affc0d25ca change algo of notthat, search by text 4 년 전
  potatowipedlifereverse b2478bfba4 fix -s 4 년 전
  potatowipedlifereverse 907bf14b94 fix ncurses 4 년 전
  potatowipedlifereverse 7302fe09ed fix ncurses 4 년 전
  potatowipedlifereverse da1a816ec8 fuck it 4 년 전
10개의 변경된 파일316개의 추가작업 그리고 225개의 파일을 삭제
  1. 1 0
      GTK/.gitigonore
  2. 23 2
      GTK/gtk-interface.c
  3. 1 0
      Makefile
  4. 62 61
      SimpleYggGen.cpp
  5. 7 1
      SimpleYggGen.hpp
  6. 220 0
      contrib/main.cpp
  7. 0 0
      contrib/x25519/x25519.cpp
  8. 0 160
      main.cpp
  9. 2 1
      ncurses/ncurses-interface.c
  10. 0 0
      ncurses/ncurses-interface.h

+ 1 - 0
GTK/.gitigonore

@@ -0,0 +1 @@
+gtk-interface.o

+ 23 - 2
GTK/gtk-interface.c

@@ -1,4 +1,5 @@
 #include <gtk/gtk.h>
+ 
 static GtkBuilder *builder;
 static GtkWidget *window;
 
@@ -17,9 +18,29 @@ void on_start_clicked(void) {
   if (highmode)
     puts("highmode true");
   char command[sizeof(PrefixPatern) + COMANDBUF];
-  sprintf(command, "./%s %s %s %s", PROGRAMNAME, PrefixPatern,
-          regexp ? "-r" : "", highmode ? "-H" : "");
+  sprintf(command, "./%s %s %s %s", PROGRAMNAME, 
+          regexp ? "-r" : "",PrefixPatern, highmode ? "-H" : "");
+#ifdef __linux__
+	#include <unistd.h> 
+	#include <sys/types.h> 
+	#include <sys/wait.h>
+pid_t pid=fork();
+if(pid==0){
+
+	static char *arguments[4];
+	arguments[0]=(regexp ? "-r" : "");
+	arguments[1]=PrefixPatern;
+	arguments[2]=(highmode ? "-H" : "");
+	arguments[3]=NULL;
+	execv("./"PROGRAMNAME,arguments);//TODO: /usr/bin/PROGRAMNAME?
+	exit(127);
+}else if(pid == getpid()){
+	waitpid(pid,0,0);
+}
+
+#else
   system(command);
+#endif
 }
 
 void on_high_mode_activated(GtkSwitch *data, gboolean state) {

+ 1 - 0
Makefile

@@ -18,6 +18,7 @@ gtk:
 
 clear:
 	rm $(programname) $(GTKINTERFACENAME) # GTK.glade
+	cd $(GTKDIR) && make clear
 
 
 	

+ 62 - 61
SimpleYggGen.cpp

@@ -87,7 +87,7 @@ void intro() {
 
 static unsigned int maxlones = 0;
 
-static dataKey pDatakey;
+static dataKey m_dataKey;
 
 static struct {
   bool reg = false;
@@ -104,22 +104,23 @@ static inline bool NotThat(const char *what, const std::regex &reg) {
 }
 
 static inline bool NotThat(const char *a, const char *b) {
-  while (*b)
-    if (*a++ != *b++)
-      return true;
-  return false;
+  //while (*b)
+   // if (*a++ != *b++)
+     // return true;
+  //return false;
+  return strstr(a, b) == 0 ? true : false;
 }
 
 void usage(void) {
   const constexpr char *help = NAMEPROGRAM
-      " [text-pattern|regex-pattern] [options]\n"
+      " [text-pattern(for just search by text, like to 200:ffff)] [options]\n"
       "-h --help, help menu\n"
-      "-r --reg,  regexp instead just text pattern (e.g. '(one|two).*')\n"
+      "-r --reg, (^2.*ffff.*$)  regexp instead just text pattern (e.g. '(one|two).*')\n"
       "--threads -t, (default count of system)\n"
       "-o --output output file (default keys.txt)\n"
       "--usage this menu\n"
       "--highhead -H mode of high head...\n"
-      "--searchadress -s (default) mode\n"
+      //"--searchadress -s (default) mode\n"
       "--limitfound=n -lN limit found\n"
       "--ncurses -n start ncurses interface\n"
       //"--prefix -p\n"
@@ -132,19 +133,26 @@ void parsing(int argc, char **args) {
 
   static struct option long_options[] = {
       {"help", no_argument, 0, 'h'},
-      {"reg", no_argument, 0, 'r'},
+      {"reg", required_argument, 0, 'r'},
       {"threads", required_argument, 0, 't'},
       {"output", required_argument, 0, 'o'},
       {"usage", no_argument, 0, 0},
       {"highhead", no_argument, 0, 'H'},
-      {"searchadress", no_argument, 0, 's'},
+     // {"searchadress", no_argument, 0, 's'},
       {"limitfound", required_argument, 0, 'l'},
       {"ncurses", no_argument, 0, 'n'},
       {0, 0, 0, 0}};
 
   int c;
   OptionBox ncursesoptions;
-  while ((c = getopt_long(argc, args, "hrt:s:o:Hsl:n", long_options,
+  auto setRegExp = [](const char*searchbytext){
+      options.reg = true;
+      options.searchtextby = new char[MAXBUF];
+      memcpy(options.searchtextby, searchbytext, strlen(searchbytext) );
+      std::cout << "RegExp pattern: "<<searchbytext << std::endl;	
+      options.regex = std::regex( options.searchtextby );
+  };
+  while ((c = getopt_long(argc, args, "hr:t:o:Hsl:n", long_options,
                           &option_index)) != -1) {
     switch (c) {
     case 0:
@@ -162,11 +170,16 @@ void parsing(int argc, char **args) {
         break;
       case RegExp:
         options.reg = true;
+        setRegExp(ncursesoptions.searchtext);
+	//goto REGEXP;
         break;
+      case Exit:
+	exit(0);
+	break;
+      default:
+      	 options.searchtextby = new char[MAXBUF];
+     	 memcpy(options.searchtextby, ncursesoptions.searchtext, MAXBUF);       
       }
-      options.searchtextby = new char[MAXBUF];
-      memcpy(options.searchtextby, ncursesoptions.searchtext, MAXBUF);
-
       break;
 
     case 'l':
@@ -176,16 +189,16 @@ void parsing(int argc, char **args) {
       options.mode = ProgramMode::high;
       options.outputpath = defaultHighSearchFileName;
       break;
-    case 's':
+    /*case 's':
       options.mode = ProgramMode::search;
       options.outputpath = defaultSearchFileName;
-      break;
+      break;*/
     case 'h':
       usage();
       exit(0);
       break;
     case 'r':
-      options.reg = true;
+      setRegExp(optarg);
       break;
     case 't':
       options.threads = atoi(optarg);
@@ -235,8 +248,7 @@ void convertSHA512ToSum(unsigned char hash[SHA512_DIGEST_LENGTH],
     sprintf(outputBuffer + (i * 2), "%02x", hash[i]);
   }
 }
-char *convertSHA512ToIPv6(unsigned char hash[SHA512_DIGEST_LENGTH],
-                          BoxKeys myKeys, int &cOnes) {
+char *convertSHA512ToIPv6(unsigned char hash[SHA512_DIGEST_LENGTH], int &cOnes) {
   // char hash[128];
   // convertSHA512ToSum(h, hash);
   unsigned char byte;
@@ -279,37 +291,31 @@ char *convertSHA512ToIPv6(unsigned char hash[SHA512_DIGEST_LENGTH],
   cOnes = lOnes;
   return addr;
 }
-char *convertSHA512ToIPv6(unsigned char hash[SHA512_DIGEST_LENGTH],
-                          BoxKeys myKeys) {
+char *convertSHA512ToIPv6(unsigned char hash[SHA512_DIGEST_LENGTH]) {
   int o;
-  return convertSHA512ToIPv6(hash, myKeys, o);
+  return convertSHA512ToIPv6(hash, o);
 }
 
 std::mutex m_writeMutex;
-static inline void addKeyPair(BoxKeys data, std::string ipv6) {
+static inline void addKeyPair() {
   std::lock_guard<std::mutex> guard(m_writeMutex);
   std::ofstream f(options.outputpath, std::ofstream::out | std::ofstream::app);
   if (f) {
-    f << "~" << std::endl;
-    f << (options.mode == ProgramMode::high ? "HighMode" : "SearchMode")
-      << std::endl;
-    f << "Your keys: " << std::endl;
-    f << "Secret key: ";
-    for (int i = 0; i < KEYSIZE; ++i) {
-      f << std::setw(2) << std::setfill('0') << std::hex
-        << (int)data.PrivateKey[i];
-    }
-    f << std::endl;
-
-    f << "Public Key: ";
-    for (int i = 0; i < 32; ++i) {
-      f << std::setw(2) << std::setfill('0') << std::hex
-        << (int)data.PublicKey[i];
-    }
-
-    f << std::endl;
-    f << "IPv6: " << ipv6 << std::endl;
-    f << "~" << std::endl;
+	f << "Your keys: " << std::endl;
+	f << "Public Key: ";
+	for(int i = 0; i < 32; ++i)
+	{
+	 f << std::setw(2) << std::setfill('0') << std::hex << (int)m_dataKey.pk[i];
+	}
+	f << std::endl;
+
+	f << "Secret key: ";
+	for(int i = 0; i < KEYSIZE; ++i)
+	{
+	 f << std::setw(2) << std::setfill('0') << std::hex << (int)m_dataKey.sk[i];
+	}
+	f << std::endl;
+	f << "IPv6: " <<m_dataKey.ip << std::endl;
   } else
     std::cout << "Can't create/reopen file " << options.outputpath << std::endl;
 }
@@ -318,14 +324,8 @@ static inline void miner(const char *prefix) {
   if (options.reg && prefix[0] != '^' && options.mode != ProgramMode::high) {
     std::cerr << "WARNING: "
               << "IF YOU DONT KNOW REGEXP PLEASE SEE IT -> https://regexr.com/"
-              << std::endl;
+              << std::endl << prefix << std::endl;
     sleep(15); // magic number
-  } else if (prefix[0] != '2' && options.mode != ProgramMode::high) {
-    std::cerr << "WARNING: "
-              << "YOU WANT TO FOUND ADRESS WHICH NOT EXIST IN YGGDRASIL, ARE "
-                 "YOU OKEY?!"
-              << std::endl;
-    sleep(30); // magic number
   }
   auto clearconsole = [](int defsleep = 1) {
 #ifndef __linux__
@@ -352,26 +352,30 @@ static inline void miner(const char *prefix) {
     auto myKeys = getKeyPair();
     unsigned char hash[SHA512_DIGEST_LENGTH];
     getSHA512(myKeys.PublicKey, hash);
-    char *ipv6 = convertSHA512ToIPv6(hash, myKeys);
+
+    /*volatile */int ones;
+    auto ipv6 = options.mode == ProgramMode::high ? convertSHA512ToIPv6(hash, ones) : convertSHA512ToIPv6(hash);
+    //printf("%s\n", ipv6);
     if (options.mode == ProgramMode::high) {
-      int ones;
-      ipv6 = convertSHA512ToIPv6(hash, myKeys, ones);
       if (ones > maxlones) {
         clearconsole();
         maxlones = ones;
         std::cout << "Found new max high-addr: "
                   << "(" << maxlones << ") " << ipv6 << std::endl;
-        addKeyPair(myKeys, ipv6);
+	ADDKEYS(m_dataKey, myKeys, ipv6);//To inline?
+        addKeyPair();
       }
     } else {
-      ipv6 = convertSHA512ToIPv6(hash, myKeys);
+      //ipv6 = convertSHA512ToIPv6(hash);
       if ((options.reg ? !NotThat(ipv6, options.regex)
                        : !NotThat(ipv6, prefix))) {
         clearconsole();
         std::cout << "Address found: "
                   << "(" << ++foundAddreses << ") " << ipv6;
         std::cout << std::flush;
-        addKeyPair(myKeys, ipv6);
+	ADDKEYS(m_dataKey, myKeys, ipv6);
+
+        addKeyPair();
         // delete newKey.sk; // not need. not-heap..
       }
     }
@@ -387,20 +391,17 @@ int main(int argc, char **argv) {
   options.outputpath = defaultSearchFileName;
   parsing(argc, argv);
 
-  if (options.reg)
-    options.regex = std::regex(argv[1]);
+
   if (options.threads < 0)
     options.threads = std::thread::hardware_concurrency();
   ;
   std::vector<std::thread> threads(options.threads);
 
   for (unsigned int j = options.threads; j--;) {
-    // std::cout << "thread " << j << " start" << std::endl;
     threads[j] = std::thread(
         static_cast<void (*)(const char *)>(miner),
         options.searchtextby == nullptr ? argv[1] : options.searchtextby);
-    // std::cout << "thread " << j << " started" << std::endl;
-  } // for
+  }
   for (unsigned int j = 0; j < (unsigned int)options.threads; j++)
     threads[j].join();
 }

+ 7 - 1
SimpleYggGen.hpp

@@ -7,7 +7,7 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 #else
-#include <Winsock2.h>
+#include <winsock2.h>
 #endif
 
 #include <fstream>
@@ -25,6 +25,12 @@
 #define NAMEPROGRAM "SimpleYggGen"
 #define COAUTHORS "lialh4, orignal, i2pd-project."
 
+//to inline?
+#define ADDKEYS(to, from, ipv6){ \
+	memcpy(to.sk, from.PrivateKey, sizeof(from.PrivateKey)); \
+	memcpy(to.pk, from.PublicKey, sizeof(from.PublicKey));\
+	to.ip =std::string(ipv6);}
+
 constexpr auto defaultHighSearchFileName = "syg-highsearch.txt";
 constexpr auto defaultSearchFileName = "syg-search.txt"; //(reg)
 

+ 220 - 0
contrib/main.cpp

@@ -0,0 +1,220 @@
+/*
+ * Спасибо PurpleI2P Project за активное содействие в написании этого кода.
+ * notabug.org/acetone/SimpleYggGen-CPP
+ *
+ * acetone, lialh4 (c) GPLv3
+ *
+ */
+
+#include <openssl/evp.h> // библиотека OpenSSL
+#include <openssl/sha.h>
+#include <iostream>      // вывод на экран
+#include <iomanip>       // форматированный вывод строк
+#include <ctime>         // системное время
+#include <bitset>        // побитовое чтение
+#include <cstring>		 // memcmp - побайтовое сравнение
+#include <vector>
+
+#define KEYSIZE 32
+
+////////////////////////////////////////////////// Заставка и прочая вода
+
+		const char randomtable[90] =
+		{
+		  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+		  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+		  'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+		  'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
+		  'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+		  'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
+		  'Y', 'Z', '!', '@', '(', ')', '/', '-', '#', '+',
+		  '$', '%', '^', '&', '*', '`', '~', '>', '<', '?',
+		  '{', '}', '[', ']', ';', ':', '_', '=', '|', '\''
+		};
+
+		std::string getrandom(int entropy, unsigned int size_of_line)
+		{
+			std::string random_value;
+			while(random_value.size() < size_of_line)
+			{
+				random_value += randomtable[(std::rand() % entropy)];
+			}
+			random_value.shrink_to_fit();
+			return random_value;
+		}
+
+		void intro()
+		{
+			srand(time(NULL));
+			int rv = 60;
+			std::cout << std::endl
+			<< "|   SimpleYggGen C++ 1.0-headhunter    |" << getrandom(2,44)   << std::endl
+			<< "|   OpenSSL inside: x25519 -> sha512   |" << getrandom(rv, 2)  << "          "  << getrandom(rv, 5) << "  " << getrandom(rv, 6) << "  " << getrandom(rv, 5)  << "          " << getrandom(rv, 2)	<< std::endl
+			<< "| notabug.org/acetone/SimpleYggGen-CPP |" << getrandom(rv, 2)  << "  "          << getrandom(rv,13) << "  " << getrandom(rv, 6) << "  " << getrandom(rv, 5)  << "  "         << getrandom(rv, 10)	<< std::endl
+			<< "|                                      |" << getrandom(rv, 2)  << "          "  << getrandom(rv, 5) << "          "                     << getrandom(rv, 5)  << "  "         << getrandom(rv, 3)	<< "     " << getrandom(rv, 2) << std::endl
+			<< "| developers: lialh4, acetone, orignal |" << getrandom(rv, 10) <<         "  "  << getrandom(rv,13) <<         "  "                     << getrandom(rv, 5)  << "  "         << getrandom(rv, 6)	<<    "  " << getrandom(rv, 2) << std::endl
+			<< "|            GPLv3  (c) 2020           |" << getrandom(rv, 2)  << "          "  << getrandom(rv, 5) << "          "                     << getrandom(rv, 5)  << "          " << getrandom(rv, 2)	<< std::endl
+			<< "| "  << __DATE__ << "                 "  << __TIME__ <<  " |"	    << getrandom(2,44) << std::endl;
+		}
+
+////////////////////////////////////////////////// Суть вопроса
+
+struct BoxKeys
+{
+    uint8_t PublicKey[KEYSIZE];
+    uint8_t PrivateKey[KEYSIZE];
+};
+
+BoxKeys getKeyPair(void)
+{
+	BoxKeys keys;
+	size_t len = KEYSIZE;
+
+	EVP_PKEY_CTX * Ctx;
+	EVP_PKEY * Pkey = nullptr;
+	Ctx = EVP_PKEY_CTX_new_id (NID_X25519, NULL);
+
+	EVP_PKEY_keygen_init (Ctx);
+	EVP_PKEY_keygen (Ctx, &Pkey);
+
+	EVP_PKEY_get_raw_public_key (Pkey, keys.PublicKey, &len);
+	EVP_PKEY_get_raw_private_key (Pkey, keys.PrivateKey, &len);
+
+	EVP_PKEY_CTX_free(Ctx);
+	EVP_PKEY_free(Pkey);
+
+	return keys;
+}
+
+int Ones(unsigned char HashValue[SHA512_DIGEST_LENGTH])
+{
+	unsigned char byte;
+	bool done;
+	int lOnes=0;
+	int nBits=0;
+	unsigned char temp[SHA512_DIGEST_LENGTH];
+	memset(temp, 0, sizeof(temp));
+	int z = 0;
+	std::vector<std::bitset<8>> bytes;
+	for(auto i = 0; i < SHA512_DIGEST_LENGTH; i++)
+	{
+		bytes.push_back(HashValue[i]);
+	}
+
+	for(auto bits : bytes){
+		for(int i = 7; i >= 0; --i)
+		{
+			if(bits[i] == 1 && !done)
+			{
+				++lOnes;
+				continue;
+			}
+			if(bits[i] == 0 && !done)
+			{
+				done = true;
+				continue;
+			}
+
+			byte = (byte << 1) | (bits[i] > 0 ? 1 : 0);
+			++nBits;
+
+			if(nBits >= 8)
+			{
+				nBits = 0;
+				temp[++z] = byte;
+			}
+		}
+	}
+	return lOnes;
+}
+
+void miner()
+{
+	unsigned char HashValue[SHA512_DIGEST_LENGTH];
+
+	uint8_t PublicKeyBest[KEYSIZE];
+	uint8_t PrivateKeyBest[KEYSIZE];
+
+	// ------------------------ ОСНОВНОЙ ЦИКЛ
+
+	int bitcount = 9; 	// переменная для хранения наибольшего количества единиц (не с нуля начинаем)
+
+	int totalcount= 0;	// счетчик основного цикла
+	bool count50 = false; // счетчики для отображения прогресса
+	bool count100 = true;
+	bool count500 = true;
+
+	while(true)
+	{
+		BoxKeys myKeys = getKeyPair();
+		SHA512(myKeys.PublicKey, KEYSIZE, HashValue);
+		int newones = Ones(HashValue);
+
+		if(newones > bitcount)
+		{
+			bitcount = newones;
+			for(int i = 0; i < KEYSIZE; ++i)
+			{
+				PublicKeyBest[i] = myKeys.PublicKey[i];
+				PrivateKeyBest[i] = myKeys.PrivateKey[i];
+			}
+			std::cout << "\nAddress:    [2" << std::setw(2) << std::setfill('0') << std::hex << bitcount << ":...]" << std::endl;
+			std::cout << "PublicKey:  ";
+			for(int i = 0; i < 32; ++i)
+			{
+				std::cout << std::setw(2) << std::setfill('0') << std::hex << (int)PublicKeyBest[i];
+			}
+			std::cout << std::endl;
+
+			std::cout << "PrivateKey: ";
+			for(int i = 0; i < 32; ++i)
+			{
+				std::cout << std::setw(2) << std::setfill('0') << std::hex << (int)PrivateKeyBest[i];
+			}
+			std::cout << std::endl;
+			count50 = false;
+			count100 = true;
+			count500 = true;
+			totalcount = 0;
+		}
+
+
+		++totalcount;
+		if(totalcount % 50000 == 0 && !count50)
+		{
+			std::cerr << "50k ";
+			std::cerr.flush();
+			count50 = true;
+			count100 = false;
+			continue;
+		}
+		if(totalcount % 100000 == 0  && !count100)
+		{
+			std::cerr << "100k ";
+			std::cerr.flush();
+			count100 = true;
+			count500 = false;
+			continue;
+		}
+		if(totalcount % 500000 == 0  && !count500)
+		{
+			std::cerr << "500k ";
+			std::cerr.flush();
+			count500 = true;
+			continue;
+		}
+		if(totalcount % 500000 == 0)
+		{
+			std::cerr << "# ";
+			std::cerr.flush();
+		}
+	}
+}
+
+// ------------------------------------------------------
+
+int main()
+{
+	intro();
+	miner();
+}

x25519/x25519.cpp → contrib/x25519/x25519.cpp


+ 0 - 160
main.cpp

@@ -1,160 +0,0 @@
-/*
- * Спасибо PurpleI2P Project за активное содействие в написании этого кода.
- * notabug.org/acetone/SimpleYggGen-CPP
- *
- * acetone (c) GPLv3
- *
- */
-
-#include <bitset>        // по-битовое чтение
-#include <ctime>         // системное время
-#include <iomanip>       // форматированный вывод строк
-#include <iostream>      // вывод на экран
-#include <openssl/evp.h> // библиотека OpenSSL
-#include <openssl/sha.h>
-
-////////////////////////////////////////////////// Заставка и прочая вода
-
-const char randomtable[90] = {
-    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e',
-    'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
-    'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
-    'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
-    'Y', 'Z', '!', '@', '(', ')', '/', '-', '#', '+', '$', '%', '^', '&', '*',
-    '`', '~', '>', '<', '?', '{', '}', '[', ']', ';', ':', '_', '=', '|', '\''};
-
-std::string getrandom(int entropy, unsigned int size_of_line) {
-  std::string random_value;
-  while (random_value.size() < size_of_line) {
-    random_value += randomtable[(std::rand() % entropy)];
-  }
-  random_value.shrink_to_fit();
-  return random_value;
-}
-
-void intro() {
-  srand(time(NULL));
-  int rv = 60;
-  std::cout << std::endl
-            << "|                                      |" << getrandom(2, 44)
-            << std::endl
-            << "| SimpleYggGen C++ 1.0-headhunter 2020 |" << getrandom(rv, 2)
-            << "          " << getrandom(rv, 5) << "  " << getrandom(rv, 6)
-            << "  " << getrandom(rv, 5) << "          " << getrandom(rv, 2)
-            << std::endl
-            << "|   OpenSSL inside: x25519 -> sha512   |" << getrandom(rv, 2)
-            << "  " << getrandom(rv, 13) << "  " << getrandom(rv, 6) << "  "
-            << getrandom(rv, 5) << "  " << getrandom(rv, 10) << std::endl
-            << "| notabug.org/acetone/SimpleYggGen-CPP |" << getrandom(rv, 2)
-            << "          " << getrandom(rv, 5) << "          "
-            << getrandom(rv, 5) << "  " << getrandom(rv, 3) << "     "
-            << getrandom(rv, 2) << std::endl
-            << "|           acetone (c) GPLv3          |" << getrandom(rv, 10)
-            << "  " << getrandom(rv, 13) << "  " << getrandom(rv, 5) << "  "
-            << getrandom(rv, 6) << "  " << getrandom(rv, 2) << std::endl
-            << "|                                      |" << getrandom(rv, 2)
-            << "          " << getrandom(rv, 5) << "          "
-            << getrandom(rv, 5) << "          " << getrandom(rv, 2) << std::endl
-            << "|     " << __DATE__ << "         " << __TIME__ << "     |"
-            << getrandom(2, 44) << std::endl;
-}
-
-////////////////////////////////////////////////// Суть вопроса
-
-void miner() {
-  // x25519 -----------------------
-  uint8_t PublicKey[32];
-  uint8_t PrivateKey[32];
-  size_t lenpub = 32;
-  size_t lenpriv = 32;
-
-  EVP_PKEY_CTX *Ctx;
-  EVP_PKEY *Pkey = nullptr;
-
-  unsigned char HashValue[128];
-
-  uint8_t PublicKeyBest[32];
-  uint8_t PrivateKeyBest[32];
-
-  int bitcount = 10; // переменная для хранения наибольшего количества единиц
-  int displayc = 0;
-
-  // ------------------------ ОСНОВНОЙ ЦИКЛ
-  while (bitcount < 255) {
-    int bit = 0; // счетчик для подсчета единиц
-    std::string s_first4bytes; // переменная для хранения хэша
-
-    Pkey = nullptr;
-    Ctx = EVP_PKEY_CTX_new_id(NID_X25519, NULL);
-
-    EVP_PKEY_keygen_init(Ctx);
-    EVP_PKEY_keygen(Ctx, &Pkey);
-
-    EVP_PKEY_get_raw_public_key(Pkey, PublicKey, &lenpub);
-    EVP_PKEY_get_raw_private_key(Pkey, PrivateKey, &lenpriv);
-
-    // sha512 --------------------------------
-    SHA512(PublicKey, 32, HashValue);
-    std::bitset<8> bits_header(
-        HashValue[0]); // получаем биты первого байта хэша
-    s_first4bytes = bits_header.to_string(); // сохраняем их в стринг
-
-    for (int y = 1; y < 4; ++y) // добавляем еще 3 байта
-    {
-      std::bitset<8> bits_header_temp(HashValue[y]);
-      s_first4bytes += bits_header_temp.to_string();
-    }
-
-    // bits ----------------------------------
-    bit = 0;
-    while (s_first4bytes[bit] != '0' &&
-           s_first4bytes[bit] == '1') // цикл по-битового анализа
-    {
-      ++bit;
-      if (bit > bitcount) // сохраняем связку лучших ключей
-      {
-        bitcount = bit;
-        for (int z = 0; z < 32; ++z) {
-          PublicKeyBest[z] = PublicKey[z];
-        }
-        for (int z = 0; z < 32; ++z) {
-          PrivateKeyBest[z] = PrivateKey[z];
-        }
-
-        // outout -------------------------------
-        if (s_first4bytes[bit] == '0') {
-          std::cout << "\nAddress:    [2" << std::setw(2) << std::setfill('0')
-                    << std::hex << bitcount << ":...]" << std::endl;
-          std::cout << "PublicKey:  ";
-          for (int i = 0; i < 32; ++i) {
-            std::cout << std::setw(2) << std::setfill('0') << std::hex
-                      << (int)PublicKeyBest[i];
-          }
-          std::cout << std::endl;
-
-          std::cout << "PrivateKey: ";
-          for (int i = 0; i < 32; ++i) {
-            std::cout << std::setw(2) << std::setfill('0') << std::hex
-                      << (int)PrivateKeyBest[i];
-          }
-          std::cout << std::endl;
-        }
-      }
-    }
-    ++displayc;
-    if (displayc % 10000 == 0) {
-      std::cerr << "-";
-      std::cerr.flush();
-    }
-    EVP_PKEY_CTX_free(Ctx);
-    EVP_PKEY_free(Pkey);
-  }
-}
-
-// ------------------------------------------------------
-
-int main() {
-  intro();
-  miner();
-  return 0;
-}

+ 2 - 1
ncurses/ncurses-interface.c

@@ -11,6 +11,7 @@ static void on_enter(const char *entry) {
   if (strstr(entry, ENTRY_EXIT)) {
     stopprogram = true;
     mvprintw(LINES - 1, 0, "BYE, BYE, BYE", entry);
+    options.engine = Exit;
   }
   ELIF(strstr(entry, ENTRY_HIGHMODE)) {
     mvprintw(LINES - 1, 0, "Enter to highhead mode?(enter/control+C)");
@@ -29,7 +30,7 @@ static void on_enter(const char *entry) {
   // mvprintw(LINES - 1,0 , ITEMSELECTEDTEXT" %s", entry);
   attroff(COLOR_PAIR(2));
   refresh();
-  if (options.engine != HighHead)
+  if (options.engine != HighHead && !stopprogram)
     start_field();
   stopprogram = true;
 }

+ 0 - 0
ncurses/ncurses-interface.h


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.