1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-keygen synced 2026-07-03 11:53:41 +02:00

rename namespace and header guards from eosio to antelope

This commit is contained in:
Henrik Hautakoski 2023-04-10 14:53:26 +02:00
parent 2679dc6ef4
commit 2b4ab78176
35 changed files with 126 additions and 127 deletions

View file

@ -4,10 +4,10 @@ cmake_minimum_required(VERSION 3.15)
# Project Info # Project Info
# -------------------------------- # --------------------------------
project(eosio-keygen project(antelope-keygen
VERSION 1.0.8 VERSION 1.0.8
DESCRIPTION "Keygenerator for EOSIO" DESCRIPTION "Keygenerator for Antelope blockchain"
HOMEPAGE_URL "https://github.com/eosswedenorg/eosio-keygen" ) HOMEPAGE_URL "https://github.com/eosswedenorg/antelope-keygen" )
set( PROJECT_MAINTAINER "Henrik Hautakoski <henrik@eossweden.org>") set( PROJECT_MAINTAINER "Henrik Hautakoski <henrik@eossweden.org>")
set( PROJECT_LICENSE_FILE ${CMAKE_CURRENT_LIST_DIR}/LICENSE ) set( PROJECT_LICENSE_FILE ${CMAKE_CURRENT_LIST_DIR}/LICENSE )
@ -102,7 +102,7 @@ set( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
configure_file(config.hpp.in "${PROJECT_BINARY_DIR}/config.hpp" @ONLY) configure_file(config.hpp.in "${PROJECT_BINARY_DIR}/config.hpp" @ONLY)
include_directories(${PROJECT_BINARY_DIR}) include_directories(${PROJECT_BINARY_DIR})
# Bundle eosio-extras on windows. # Bundle antelope-extras on windows.
if (WIN32) if (WIN32)
include(extras) include(extras)
list(APPEND components extras ) list(APPEND components extras )

View file

@ -1,11 +1,11 @@
![](https://github.com/eosswedenorg/eosio-keygen/workflows/CI/badge.svg) ![](https://github.com/eosswedenorg/antelope-keygen/workflows/CI/badge.svg)
[![GitHub release](https://img.shields.io/github/v/release/eosswedenorg/eosio-keygen?include_prereleases)](https://github.com/eosswedenorg/eosio-keygen/releases/latest) [![GitHub release](https://img.shields.io/github/v/release/eosswedenorg/antelope-keygen?include_prereleases)](https://github.com/eosswedenorg/antelope-keygen/releases/latest)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# EOSIO Keygen # Antelope Keygen
This program generates public and private keypair for [EOS](https://eos.io/) This program generates public and private keypair for [Antelope IO](https://antelope.io)
## Compile ## Compile
@ -164,7 +164,6 @@ $ curl https://apt.eossweden.org/key 2> /dev/null | sudo apt-key add -
$ sudo apt-add-repository -y 'deb [arch=amd64] https://apt.eossweden.org/main `lsb_release -cs` stable' $ sudo apt-add-repository -y 'deb [arch=amd64] https://apt.eossweden.org/main `lsb_release -cs` stable'
$ sudo apt-get install libantelope-dev $ sudo apt-get install libantelope-dev
``` ```
or manually via `.deb` file from [github](https://github.com/eosswedenorg/libantelope/releases) or manually via `.deb` file from [github](https://github.com/eosswedenorg/libantelope/releases)
```sh ```sh

View file

@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.15)
# Project Info # Project Info
# -------------------------------- # --------------------------------
project(eosio-keygen project(antelope-keygen
VERSION ${CMAKE_PROJECT_VERSION} VERSION ${CMAKE_PROJECT_VERSION}
LANGUAGES CXX) LANGUAGES CXX)
@ -67,7 +67,7 @@ install(FILES ${PROJECT_BINARY_DIR}/README.cli.md
COMPONENT cli) COMPONENT cli)
if (UNIX) if (UNIX)
configure_file( docs/eosio-keygen.1.in ${PROJECT_BINARY_DIR}/man1/eosio-keygen.1 ) configure_file( docs/antelope-keygen.1.in ${PROJECT_BINARY_DIR}/man1/antelope-keygen.1 )
install(DIRECTORY ${PROJECT_BINARY_DIR}/man1 install(DIRECTORY ${PROJECT_BINARY_DIR}/man1
DESTINATION ${CMAKE_INSTALL_MANDIR} DESTINATION ${CMAKE_INSTALL_MANDIR}

View file

@ -1,9 +1,9 @@
# eosio-keygen (cli) # antelope-keygen (cli)
Generate public and private keypair for [EOSIO](https://eos.io/) Generate public and private keypair for [Antelope IO](https://antelope.io)
Source code is available at [github.com](https://github.com/eosswedenorg/eosio-keygen) Source code is available at [github.com](https://github.com/eosswedenorg/antelope-keygen)
## Synopsis ## Synopsis
@ -19,7 +19,7 @@ Source code is available at [github.com](https://github.com/eosswedenorg/eosio-k
## Description ## Description
Output one EOSIO key pair if no arguments are given. Output one Antelope key pair if no arguments are given.
Options and subcommands are as follows: Options and subcommands are as follows:
### General flags ### General flags
@ -70,7 +70,7 @@ Number of keys to search for (default is 10)
### benchmark command ### benchmark command
`eosio-keygen benchmark [num_keys]` `antelope-keygen benchmark [num_keys]`
performs a benchmark test, generating `num_keys` keys and measuring the time. performs a benchmark test, generating `num_keys` keys and measuring the time.

View file

@ -25,7 +25,7 @@
#include <libantelope/ec.hpp> #include <libantelope/ec.hpp>
#include "benchmark.hpp" #include "benchmark.hpp"
namespace eoskeygen { namespace antelopekeygen {
std::chrono::duration<float> _run_benchmark(size_t num_keys) { std::chrono::duration<float> _run_benchmark(size_t num_keys) {
auto start = std::chrono::steady_clock::now(); auto start = std::chrono::steady_clock::now();
@ -47,4 +47,4 @@ void benchmark(size_t num_keys, struct benchmark_result* res) {
res->kps = static_cast<float>(num_keys) / res->sec; res->kps = static_cast<float>(num_keys) / res->sec;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -26,7 +26,7 @@
#include <ctime> #include <ctime>
namespace eoskeygen { namespace antelopekeygen {
struct benchmark_result { struct benchmark_result {
float sec; // elapsed seconds. float sec; // elapsed seconds.
@ -35,6 +35,6 @@ struct benchmark_result {
void benchmark(size_t num_keys, struct benchmark_result* res); void benchmark(size_t num_keys, struct benchmark_result* res);
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_BENCHMARK_H */ #endif /* EOSIOKEYGEN_BENCHMARK_H */

View file

@ -28,7 +28,7 @@
#include "console.hpp" #include "console.hpp"
#include "cli_key_search_result.hpp" #include "cli_key_search_result.hpp"
namespace eoskeygen { namespace antelopekeygen {
static size_t highlight(console::Color color, const std::string& str, size_t pos, size_t len) { static size_t highlight(console::Color color, const std::string& str, size_t pos, size_t len) {
@ -74,4 +74,4 @@ void CliKeySearchResult::onResult(const struct libantelope::ec_keypair* key, con
<< "Private: " << libantelope::wif_priv_encode(key->secret, m_codec.pvt) << std::endl; << "Private: " << libantelope::wif_priv_encode(key->secret, m_codec.pvt) << std::endl;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -31,7 +31,7 @@
#include <eoskeygen/key_search.hpp> #include <eoskeygen/key_search.hpp>
#include <eoskeygen/key_search_result.hpp> #include <eoskeygen/key_search_result.hpp>
namespace eoskeygen { namespace antelopekeygen {
class Dictionary; class Dictionary;
@ -49,6 +49,6 @@ protected :
libantelope::wif_codec_t m_codec; libantelope::wif_codec_t m_codec;
}; };
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_KEY_SEARCH_HELPERS_H */ #endif /* EOSIOKEYGEN_KEY_SEARCH_HELPERS_H */

View file

@ -25,7 +25,7 @@
#include "isatty.hpp" #include "isatty.hpp"
#include "console.hpp" #include "console.hpp"
namespace eoskeygen { namespace console { namespace antelopekeygen { namespace console {
bool disable_color = false; bool disable_color = false;
@ -45,4 +45,4 @@ bool isColorsSupported(const std::ostream& os) {
return disable_color == false && isatty(fd); return disable_color == false && isatty(fd);
} }
} } // namespace eoskeygen::console } } // namespace antelopekeygen::console

View file

@ -26,7 +26,7 @@
#include <ostream> #include <ostream>
namespace eoskeygen { namespace antelopekeygen {
namespace console { namespace console {
@ -86,6 +86,6 @@ namespace console {
} // namespace console } // namespace console
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_CONSOLE_H */ #endif /* EOSIOKEYGEN_CONSOLE_H */

View file

@ -24,7 +24,7 @@
#include <iostream> #include <iostream>
#include "console.hpp" #include "console.hpp"
namespace eoskeygen { namespace antelopekeygen {
namespace console { namespace console {
@ -80,4 +80,4 @@ std::ostream& operator<<(std::ostream& os, const fg& obj) {
} // namespace console } // namespace console
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -25,7 +25,7 @@
#include <iostream> #include <iostream>
#include "console.hpp" #include "console.hpp"
namespace eoskeygen { namespace antelopekeygen {
// WinAPI colors // WinAPI colors
#define FG_BLACK 0 #define FG_BLACK 0
@ -105,4 +105,4 @@ std::ostream& operator<<(std::ostream& os, const fg& obj) {
} // namespace console } // namespace console
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -31,7 +31,7 @@
#endif #endif
#include "isatty.hpp" #include "isatty.hpp"
namespace eoskeygen { namespace antelopekeygen {
bool isatty(int fd) { bool isatty(int fd) {
return ::_isatty(fd); return ::_isatty(fd);
@ -42,4 +42,4 @@ bool isatty(FILE* fd) {
return fd ? isatty(_fileno(fd)) : false; return fd ? isatty(_fileno(fd)) : false;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -26,12 +26,12 @@
#include <stdio.h> #include <stdio.h>
namespace eoskeygen { namespace antelopekeygen {
bool isatty(int fd); bool isatty(int fd);
bool isatty(FILE* fd); bool isatty(FILE* fd);
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_CORE_ISATTY_H */ #endif /* EOSIOKEYGEN_CORE_ISATTY_H */

View file

@ -62,10 +62,10 @@ public:
} }
}; };
int cmd_search(const eoskeygen::strlist_t& words, const eoskeygen::Dictionary& dict, int count) { int cmd_search(const antelopekeygen::strlist_t& words, const antelopekeygen::Dictionary& dict, int count) {
eoskeygen::KeySearch ks; antelopekeygen::KeySearch ks;
eoskeygen::CliKeySearchResult rs(dict, key_codec); antelopekeygen::CliKeySearchResult rs(dict, key_codec);
ks.setPrefix(key_codec.pub); ks.setPrefix(key_codec.pub);
ks.setCallback(&rs); ks.setCallback(&rs);
@ -82,7 +82,7 @@ int cmd_search(const eoskeygen::strlist_t& words, const eoskeygen::Dictionary& d
if (option_l33t) { if (option_l33t) {
for(std::size_t i = 0; i < words.size(); i++) { for(std::size_t i = 0; i < words.size(); i++) {
ks.addList(eoskeygen::l33twords(words[i])); ks.addList(antelopekeygen::l33twords(words[i]));
} }
} else { } else {
ks.addList(words); ks.addList(words);
@ -93,7 +93,7 @@ int cmd_search(const eoskeygen::strlist_t& words, const eoskeygen::Dictionary& d
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* EOSIOKEYGEN_HAVE_THREADS */
std::cout << "Searching for " << count std::cout << "Searching for " << count
<< " keys containing: " << eoskeygen::strlist::join(ks.getList(), ",") << " keys containing: " << antelopekeygen::strlist::join(ks.getList(), ",")
#ifdef EOSIOKEYGEN_HAVE_THREADS #ifdef EOSIOKEYGEN_HAVE_THREADS
<< ", Using: " << ks.getThreadCount() << " threads" << ", Using: " << ks.getThreadCount() << " threads"
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* EOSIOKEYGEN_HAVE_THREADS */
@ -106,12 +106,12 @@ int cmd_search(const eoskeygen::strlist_t& words, const eoskeygen::Dictionary& d
void cmd_benchmark(size_t num_keys) { void cmd_benchmark(size_t num_keys) {
struct eoskeygen::benchmark_result res; struct antelopekeygen::benchmark_result res;
std::cout << "Benchmark: Generating " std::cout << "Benchmark: Generating "
<< num_keys << " keys" << std::endl; << num_keys << " keys" << std::endl;
eoskeygen::benchmark(num_keys, &res); antelopekeygen::benchmark(num_keys, &res);
std::cout << "Result: Took " << res.sec << " seconds, " std::cout << "Result: Took " << res.sec << " seconds, "
<< res.kps << " keys per second." << std::endl; << res.kps << " keys per second." << std::endl;
@ -146,7 +146,7 @@ int main(int argc, char **argv) {
search_cmd->add_option("--threads", option_num_threads, search_cmd->add_option("--threads", option_num_threads,
"Use <num> of parallel threads for searching.\n" "Use <num> of parallel threads for searching.\n"
"Default is what the operating system recomends.") "Default is what the operating system recomends.")
->default_val(eoskeygen::KeySearch::max_threads()); ->default_val(antelopekeygen::KeySearch::max_threads());
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* EOSIOKEYGEN_HAVE_THREADS */
@ -185,15 +185,15 @@ int main(int argc, char **argv) {
} }
if (search_cmd->parsed()) { if (search_cmd->parsed()) {
eoskeygen::strlist_t words; antelopekeygen::strlist_t words;
eoskeygen::Dictionary dict; antelopekeygen::Dictionary dict;
if (*monocrome) { if (*monocrome) {
eoskeygen::console::disable_color = true; antelopekeygen::console::disable_color = true;
} }
for (auto item : dict_list) { for (auto item : dict_list) {
eoskeygen::Dictionary d; antelopekeygen::Dictionary d;
if (d.loadFromFile(item)) { if (d.loadFromFile(item)) {
dict.add(d); dict.add(d);
@ -203,7 +203,7 @@ int main(int argc, char **argv) {
} }
for (auto item : lang_list) { for (auto item : lang_list) {
eoskeygen::Dictionary d; antelopekeygen::Dictionary d;
std::string filename(CONFIG_SHARE_FULL_PATH "/dicts/" + item); std::string filename(CONFIG_SHARE_FULL_PATH "/dicts/" + item);
if (d.loadFromFile(filename)) { if (d.loadFromFile(filename)) {
@ -215,7 +215,7 @@ int main(int argc, char **argv) {
if (search_words.rfind("file:", 0) == 0) { if (search_words.rfind("file:", 0) == 0) {
std::string filename = search_words.substr(5); std::string filename = search_words.substr(5);
if (!eoskeygen::readLines(filename, words)) { if (!antelopekeygen::readLines(filename, words)) {
std::cerr << "Could not read file: " << filename << std::endl; std::cerr << "Could not read file: " << filename << std::endl;
goto end; goto end;
} }
@ -225,7 +225,7 @@ int main(int argc, char **argv) {
goto end; goto end;
} }
} else { } else {
words = eoskeygen::strlist::splitw(search_words); words = antelopekeygen::strlist::splitw(search_words);
} }
rc = cmd_search(words, dict, search_count); rc = cmd_search(words, dict, search_count);

View file

@ -28,7 +28,7 @@ set( COMMON_SOURCE
if (USE_THREADS) if (USE_THREADS)
find_package(Threads) find_package(Threads)
if (Threads_FOUND) if (Threads_FOUND)
set( EOSIOKEYGEN_HAVE_THREADS TRUE ) set( ANTELOPEKEYGEN_HAVE_THREADS TRUE )
set( COMMON_SOURCE ${COMMON_SOURCE} src/key_search_mt.cpp ) set( COMMON_SOURCE ${COMMON_SOURCE} src/key_search_mt.cpp )
endif (Threads_FOUND) endif (Threads_FOUND)
endif (USE_THREADS) endif (USE_THREADS)

View file

@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_CONFIG_H #ifndef ANTELOPEKEYGEN_COMMON_CONFIG_H
#define EOSIOKEYGEN_COMMON_CONFIG_H #define ANTELOPEKEYGEN_COMMON_CONFIG_H
// Defined if we have thread support. // Defined if we have thread support.
#cmakedefine EOSIOKEYGEN_HAVE_THREADS #cmakedefine ANTELOPEKEYGEN_HAVE_THREADS
#endif /* EOSIOKEYGEN_COMMON_CONFIG_H */ #endif /* ANTELOPEKEYGEN_COMMON_CONFIG_H */

View file

@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_CORE_DICTIONARY_H #ifndef ANTELOPEKEYGEN_COMMON_CORE_DICTIONARY_H
#define EOSIOKEYGEN_COMMON_CORE_DICTIONARY_H #define ANTELOPEKEYGEN_COMMON_CORE_DICTIONARY_H
#include <string> #include <string>
#include <map> #include <map>
#include <set> #include <set>
namespace eoskeygen { namespace antelopekeygen {
class Dictionary class Dictionary
{ {
@ -70,6 +70,6 @@ protected :
std::set<std::string> m_words; std::set<std::string> m_words;
}; };
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_COMMON_CORE_DICTIONARY_H */ #endif /* ANTELOPEKEYGEN_COMMON_CORE_DICTIONARY_H */

View file

@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_CORE_FILE_H #ifndef ANTELOPEKEYGEN_COMMON_CORE_FILE_H
#define EOSIOKEYGEN_COMMON_CORE_FILE_H #define ANTELOPEKEYGEN_COMMON_CORE_FILE_H
#include <eoskeygen/core/strlist.hpp> #include <eoskeygen/core/strlist.hpp>
namespace eoskeygen { namespace antelopekeygen {
bool readLines(const std::string& filename, strlist_t& lines); bool readLines(const std::string& filename, strlist_t& lines);
} // namespace } // namespace
#endif /* EOSIOKEYGEN_COMMON_CORE_FILE_H */ #endif /* ANTELOPEKEYGEN_COMMON_CORE_FILE_H */

View file

@ -21,16 +21,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_CORE_LEET_H #ifndef ANTELOPEKEYGEN_COMMON_CORE_LEET_H
#define EOSIOKEYGEN_COMMON_CORE_LEET_H #define ANTELOPEKEYGEN_COMMON_CORE_LEET_H
#include <string> #include <string>
#include <eoskeygen/core/strlist.hpp> #include <eoskeygen/core/strlist.hpp>
namespace eoskeygen { namespace antelopekeygen {
strlist_t l33twords(std::string str); strlist_t l33twords(std::string str);
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_COMMON_CORE_LEET_H */ #endif /* ANTELOPEKEYGEN_COMMON_CORE_LEET_H */

View file

@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_CORE_STRING_H #ifndef ANTELOPEKEYGEN_COMMON_CORE_STRING_H
#define EOSIOKEYGEN_COMMON_CORE_STRING_H #define ANTELOPEKEYGEN_COMMON_CORE_STRING_H
#include <vector> #include <vector>
#include <string> #include <string>
namespace eoskeygen { namespace antelopekeygen {
std::string& strtolower(std::string& str); std::string& strtolower(std::string& str);
@ -35,6 +35,6 @@ std::string& rtrim(std::string& str);
std::string& ltrim(std::string& str); std::string& ltrim(std::string& str);
std::string& trim(std::string& str); std::string& trim(std::string& str);
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_COMMON_CORE_STRING_H */ #endif /* ANTELOPEKEYGEN_COMMON_CORE_STRING_H */

View file

@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_CORE_STRLIST_H #ifndef ANTELOPEKEYGEN_COMMON_CORE_STRLIST_H
#define EOSIOKEYGEN_COMMON_CORE_STRLIST_H #define ANTELOPEKEYGEN_COMMON_CORE_STRLIST_H
#include <vector> #include <vector>
#include <string> #include <string>
namespace eoskeygen { namespace antelopekeygen {
typedef std::vector<std::string> strlist_t; typedef std::vector<std::string> strlist_t;
@ -45,6 +45,6 @@ strlist_t& strip(strlist_t& list, strlist_stripfunc_t fn);
} // namespace strlist } // namespace strlist
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_COMMON_CORE_STRLIST_H */ #endif /* ANTELOPEKEYGEN_COMMON_CORE_STRLIST_H */

View file

@ -21,8 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_KEY_SEARCH_H #ifndef ANTELOPEKEYGEN_COMMON_KEY_SEARCH_H
#define EOSIOKEYGEN_COMMON_KEY_SEARCH_H #define ANTELOPEKEYGEN_COMMON_KEY_SEARCH_H
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
@ -31,7 +31,7 @@
#include <eoskeygen/core/dictionary.hpp> #include <eoskeygen/core/dictionary.hpp>
#include <eoskeygen/core/strlist.hpp> #include <eoskeygen/core/strlist.hpp>
namespace eoskeygen { namespace antelopekeygen {
class IKeySearchResult; class IKeySearchResult;
@ -64,7 +64,7 @@ public :
// Set callback for search result. // Set callback for search result.
void setCallback(IKeySearchResult* callback); void setCallback(IKeySearchResult* callback);
#ifdef EOSIOKEYGEN_HAVE_THREADS #ifdef ANTELOPEKEYGEN_HAVE_THREADS
// Returns the maximum number of threads // Returns the maximum number of threads
// reported by the operating system. // reported by the operating system.
static size_t max_threads(); static size_t max_threads();
@ -73,7 +73,7 @@ public :
void setThreadCount(size_t num); void setThreadCount(size_t num);
size_t getThreadCount() const; size_t getThreadCount() const;
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* ANTELOPEKEYGEN_HAVE_THREADS */
// Aborts find() operation if started. // Aborts find() operation if started.
// This is useful for multithreaded code (like GUI application) // This is useful for multithreaded code (like GUI application)
@ -90,11 +90,11 @@ protected :
// returns true if a word was found (stored in <result>), false otherwise. // returns true if a word was found (stored in <result>), false otherwise.
bool _contains_word(const struct libantelope::ec_keypair* key, struct result& result); bool _contains_word(const struct libantelope::ec_keypair* key, struct result& result);
#ifdef EOSIOKEYGEN_HAVE_THREADS #ifdef ANTELOPEKEYGEN_HAVE_THREADS
void _thr_proc(); void _thr_proc();
void _search_mt(); void _search_mt();
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* ANTELOPEKEYGEN_HAVE_THREADS */
void _search_linear(); void _search_linear();
@ -112,14 +112,14 @@ protected :
// Current number of keys found. // Current number of keys found.
std::size_t m_count; std::size_t m_count;
#ifdef EOSIOKEYGEN_HAVE_THREADS #ifdef ANTELOPEKEYGEN_HAVE_THREADS
// Number of threads to use. // Number of threads to use.
size_t m_threads; size_t m_threads;
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* ANTELOPEKEYGEN_HAVE_THREADS */
IKeySearchResult* m_callback; IKeySearchResult* m_callback;
}; };
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_COMMON_KEY_SEARCH_H */ #endif /* ANTELOPEKEYGEN_COMMON_KEY_SEARCH_H */

View file

@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef EOSIOKEYGEN_COMMON_KEY_SEARCH_RESULT_H #ifndef ANTELOPEKEYGEN_COMMON_KEY_SEARCH_RESULT_H
#define EOSIOKEYGEN_COMMON_KEY_SEARCH_RESULT_H #define ANTELOPEKEYGEN_COMMON_KEY_SEARCH_RESULT_H
#include <eoskeygen/key_search.hpp> #include <eoskeygen/key_search.hpp>
namespace eoskeygen { namespace antelopekeygen {
class IKeySearchResult class IKeySearchResult
{ {
@ -35,6 +35,6 @@ public :
virtual void onResult(const struct libantelope::ec_keypair* key, const struct KeySearch::result& result) = 0; virtual void onResult(const struct libantelope::ec_keypair* key, const struct KeySearch::result& result) = 0;
}; };
} // namespace eoskeygen } // namespace antelopekeygen
#endif /* EOSIOKEYGEN_COMMON_KEY_SEARCH_RESULT_H */ #endif /* ANTELOPEKEYGEN_COMMON_KEY_SEARCH_RESULT_H */

View file

@ -29,7 +29,7 @@
#include <eoskeygen/core/dictionary.hpp> #include <eoskeygen/core/dictionary.hpp>
#include <eoskeygen/core/file.hpp> #include <eoskeygen/core/file.hpp>
namespace eoskeygen { namespace antelopekeygen {
struct StringContains { struct StringContains {
StringContains(const std::string& str, std::vector<size_t>& pos) : m_str(str), m_pos(pos) {} StringContains(const std::string& str, std::vector<size_t>& pos) : m_str(str), m_pos(pos) {}
@ -126,4 +126,4 @@ Dictionary::search_result_t Dictionary::search(const std::string& subject) const
return res; return res;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -25,7 +25,7 @@
#include <eoskeygen/core/string.hpp> #include <eoskeygen/core/string.hpp>
#include <eoskeygen/core/file.hpp> #include <eoskeygen/core/file.hpp>
namespace eoskeygen { namespace antelopekeygen {
bool readLines(const std::string& filename, strlist_t& lines) { bool readLines(const std::string& filename, strlist_t& lines) {
@ -46,4 +46,4 @@ bool readLines(const std::string& filename, strlist_t& lines) {
return true; return true;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -24,7 +24,7 @@
#include <algorithm> #include <algorithm>
#include <eoskeygen/core/leet.hpp> #include <eoskeygen/core/leet.hpp>
namespace eoskeygen { namespace antelopekeygen {
static bool is_l33t(char ch, char& r) { static bool is_l33t(char ch, char& r) {
@ -79,4 +79,4 @@ strlist_t l33twords(std::string str) {
return list; return list;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -26,7 +26,7 @@
#include <algorithm> #include <algorithm>
#include <eoskeygen/core/string.hpp> #include <eoskeygen/core/string.hpp>
namespace eoskeygen { namespace antelopekeygen {
std::string& strtolower(std::string& str) { std::string& strtolower(std::string& str) {
std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c){ return std::tolower(c); }); std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c){ return std::tolower(c); });
@ -49,4 +49,4 @@ std::string& trim(std::string& str) {
return ltrim(rtrim(str)); return ltrim(rtrim(str));
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -25,7 +25,7 @@
#include <eoskeygen/core/string.hpp> #include <eoskeygen/core/string.hpp>
#include <eoskeygen/core/strlist.hpp> #include <eoskeygen/core/strlist.hpp>
namespace eoskeygen { namespace antelopekeygen {
strlist_t strlist::splitw(const std::string& str, const std::string& delim) { strlist_t strlist::splitw(const std::string& str, const std::string& delim) {
@ -48,7 +48,7 @@ strlist_t strlist::split(const std::string& str, const std::string& delim) {
return r; return r;
} }
std::string strlist::join(const eoskeygen::strlist_t& list, const std::string& delim) { std::string strlist::join(const strlist_t& list, const std::string& delim) {
std::string out; std::string out;
@ -72,4 +72,4 @@ strlist_t& strlist::strip(strlist_t& list, strlist_stripfunc_t fn) {
return list; return list;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -28,7 +28,7 @@
#include <eoskeygen/key_search_result.hpp> #include <eoskeygen/key_search_result.hpp>
#include <eoskeygen/key_search.hpp> #include <eoskeygen/key_search.hpp>
namespace eoskeygen { namespace antelopekeygen {
KeySearch::KeySearch() : KeySearch::KeySearch() :
m_prefix ("EOS"), m_prefix ("EOS"),
@ -128,4 +128,4 @@ bool KeySearch::_contains_word(const struct libantelope::ec_keypair* key, struct
return false; return false;
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -29,7 +29,7 @@
#include <eoskeygen/key_search_result.hpp> #include <eoskeygen/key_search_result.hpp>
#include <eoskeygen/key_search.hpp> #include <eoskeygen/key_search.hpp>
namespace eoskeygen { namespace antelopekeygen {
// Mutex guard for m_count. // Mutex guard for m_count.
std::mutex g_count_mtx; std::mutex g_count_mtx;
@ -98,4 +98,4 @@ void KeySearch::_search_mt()
} }
} }
} // namespace eoskeygen } // namespace antelopekeygen

View file

@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
project(eosio-keygen-gui project(antelope-keygen-gui
VERSION ${CMAKE_PROJECT_VERSION} VERSION ${CMAKE_PROJECT_VERSION}
DESCRIPTION "Keygenerator for EOSIO (gui)" DESCRIPTION "Keygenerator for Antelope blockchain (gui)"
LANGUAGES CXX) LANGUAGES CXX)
# Append modules dir # Append modules dir

View file

@ -72,8 +72,8 @@ m_btn_clear ("Clear")
m_layout.addWidget(&m_leet_cb, 0, 2); m_layout.addWidget(&m_leet_cb, 0, 2);
#ifdef EOSIOKEYGEN_HAVE_THREADS #ifdef EOSIOKEYGEN_HAVE_THREADS
m_num_threads.setValue((int) eoskeygen::KeySearch::max_threads()); m_num_threads.setValue((int) antelopekeygen::KeySearch::max_threads());
m_num_threads.setRange(1, (int) eoskeygen::KeySearch::max_threads()); m_num_threads.setRange(1, (int) antelopekeygen::KeySearch::max_threads());
m_num_threads.setSuffix(" Threads"); m_num_threads.setSuffix(" Threads");
m_layout.addWidget(&m_num_threads, 0, 3); m_layout.addWidget(&m_num_threads, 0, 3);
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* EOSIOKEYGEN_HAVE_THREADS */
@ -121,7 +121,7 @@ void SearchWindow::initSignals()
void SearchWindow::loadDictionaries() void SearchWindow::loadDictionaries()
{ {
QStringList list; QStringList list;
eoskeygen::Dictionary tmpDict; antelopekeygen::Dictionary tmpDict;
std::string base_path(CONFIG_DICT_FULL_PATH); std::string base_path(CONFIG_DICT_FULL_PATH);
// Clear dictionary first. // Clear dictionary first.
@ -146,7 +146,7 @@ void SearchWindow::loadDictionaries()
} }
} }
void SearchWindow::onResult(const struct libantelope::ec_keypair* key, const struct eoskeygen::KeySearch::result& result) void SearchWindow::onResult(const struct libantelope::ec_keypair* key, const struct antelopekeygen::KeySearch::result& result)
{ {
int pos = (int) result.pos; int pos = (int) result.pos;
int len = (int) result.len; int len = (int) result.len;
@ -156,7 +156,7 @@ void SearchWindow::onResult(const struct libantelope::ec_keypair* key, const str
QString mid = pub.mid(pos, len); QString mid = pub.mid(pos, len);
QString left = pub.left(pos); QString left = pub.left(pos);
QString right = pub.mid(pos + len, pub.size() - pos); QString right = pub.mid(pos + len, pub.size() - pos);
eoskeygen::Dictionary::search_result_t dict_res = m_dict.search(pub.toStdString()); antelopekeygen::Dictionary::search_result_t dict_res = m_dict.search(pub.toStdString());
QString out = "Public: " + pub.left(pub_prefix_len); QString out = "Public: " + pub.left(pub_prefix_len);
for(int i = pub_prefix_len; i < pub.length(); ) { for(int i = pub_prefix_len; i < pub.length(); ) {
@ -198,12 +198,12 @@ void SearchWindow::search()
} }
const std::string& input = m_txt_search.text().toLocal8Bit().constData(); const std::string& input = m_txt_search.text().toLocal8Bit().constData();
eoskeygen::strlist_t list; antelopekeygen::strlist_t list;
if (m_leet_cb.isChecked()) { if (m_leet_cb.isChecked()) {
list = eoskeygen::l33twords(input); list = antelopekeygen::l33twords(input);
} else { } else {
list = eoskeygen::strlist::splitw(input); list = antelopekeygen::strlist::splitw(input);
} }
// Validate that we atleast got something to search for. // Validate that we atleast got something to search for.
@ -222,10 +222,10 @@ void SearchWindow::search()
m_ksearch.setThreadCount(m_num_threads.value()); m_ksearch.setThreadCount(m_num_threads.value());
#endif /* EOSIOKEYGEN_HAVE_THREADS */ #endif /* EOSIOKEYGEN_HAVE_THREADS */
QFuture<void> future = QtConcurrent::run(&m_ksearch, &eoskeygen::KeySearch::find, m_num_results.value()); QFuture<void> future = QtConcurrent::run(&m_ksearch, &antelopekeygen::KeySearch::find, m_num_results.value());
m_worker.setFuture(future); m_worker.setFuture(future);
m_status.setText("Searching for: " + QString::fromStdString(eoskeygen::strlist::join(list, ", "))); m_status.setText("Searching for: " + QString::fromStdString(antelopekeygen::strlist::join(list, ", ")));
} }
void SearchWindow::output(const std::string& html) void SearchWindow::output(const std::string& html)

View file

@ -37,13 +37,13 @@
#include <eoskeygen/key_search.hpp> #include <eoskeygen/key_search.hpp>
#include "MultiSelect.hpp" #include "MultiSelect.hpp"
class SearchWindow : public QWidget, public eoskeygen::IKeySearchResult class SearchWindow : public QWidget, public antelopekeygen::IKeySearchResult
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SearchWindow(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()); explicit SearchWindow(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
void onResult(const struct libantelope::ec_keypair* key, const struct eoskeygen::KeySearch::result& result); void onResult(const struct libantelope::ec_keypair* key, const struct antelopekeygen::KeySearch::result& result);
private : private :
void initSignals(); void initSignals();
@ -76,9 +76,9 @@ private:
// Search worker thread. // Search worker thread.
QFutureWatcher<void> m_worker; QFutureWatcher<void> m_worker;
eoskeygen::KeySearch m_ksearch; antelopekeygen::KeySearch m_ksearch;
eoskeygen::Dictionary m_dict; antelopekeygen::Dictionary m_dict;
// Widgets // Widgets
// ---------------- // ----------------