mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-07-04 12:03:41 +02:00
Update from libeosio v0.1.7 to libantelope v0.2.0
This commit is contained in:
parent
d5da7d1491
commit
914205541a
17 changed files with 119 additions and 119 deletions
|
|
@ -22,7 +22,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <libeosio/ec.hpp>
|
#include <libantelope/ec.hpp>
|
||||||
#include "benchmark.hpp"
|
#include "benchmark.hpp"
|
||||||
|
|
||||||
namespace eoskeygen {
|
namespace eoskeygen {
|
||||||
|
|
@ -30,8 +30,8 @@ namespace eoskeygen {
|
||||||
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();
|
||||||
for(size_t i = 0; i < num_keys; i++) {
|
for(size_t i = 0; i < num_keys; i++) {
|
||||||
struct libeosio::ec_keypair k;
|
struct libantelope::ec_keypair k;
|
||||||
libeosio::ec_generate_key(&k);
|
libantelope::ec_generate_key(&k);
|
||||||
}
|
}
|
||||||
return std::chrono::steady_clock::now() - start;
|
return std::chrono::steady_clock::now() - start;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
#include <eoskeygen/core/dictionary.hpp>
|
#include <eoskeygen/core/dictionary.hpp>
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "cli_key_search_result.hpp"
|
#include "cli_key_search_result.hpp"
|
||||||
|
|
@ -38,15 +38,15 @@ static size_t highlight(console::Color color, const std::string& str, size_t pos
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
CliKeySearchResult::CliKeySearchResult(const Dictionary& dict, const libeosio::wif_codec_t& codec) :
|
CliKeySearchResult::CliKeySearchResult(const Dictionary& dict, const libantelope::wif_codec_t& codec) :
|
||||||
m_dict (dict),
|
m_dict (dict),
|
||||||
m_codec (codec)
|
m_codec (codec)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CliKeySearchResult::onResult(const struct libeosio::ec_keypair* key, const struct KeySearch::result& result) {
|
void CliKeySearchResult::onResult(const struct libantelope::ec_keypair* key, const struct KeySearch::result& result) {
|
||||||
|
|
||||||
std::string pub = libeosio::wif_pub_encode(key->pub, m_codec.pub);
|
std::string pub = libantelope::wif_pub_encode(key->pub, m_codec.pub);
|
||||||
Dictionary::search_result_t dict_res = m_dict.search(pub);
|
Dictionary::search_result_t dict_res = m_dict.search(pub);
|
||||||
int pub_prefix_len = (int) m_codec.pub.length();
|
int pub_prefix_len = (int) m_codec.pub.length();
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ void CliKeySearchResult::onResult(const struct libeosio::ec_keypair* key, const
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << std::endl
|
std::cout << std::endl
|
||||||
<< "Private: " << libeosio::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 eoskeygen
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
#define EOSIOKEYGEN_KEY_SEARCH_HELPERS_H
|
#define EOSIOKEYGEN_KEY_SEARCH_HELPERS_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <libeosio/ec.hpp>
|
#include <libantelope/ec.hpp>
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
#include <eoskeygen/core/string.hpp>
|
#include <eoskeygen/core/string.hpp>
|
||||||
#include <eoskeygen/key_search.hpp>
|
#include <eoskeygen/key_search.hpp>
|
||||||
#include <eoskeygen/key_search_result.hpp>
|
#include <eoskeygen/key_search_result.hpp>
|
||||||
|
|
@ -38,15 +38,15 @@ class Dictionary;
|
||||||
class CliKeySearchResult : public IKeySearchResult
|
class CliKeySearchResult : public IKeySearchResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CliKeySearchResult(const Dictionary& dict, const libeosio::wif_codec_t& codec);
|
CliKeySearchResult(const Dictionary& dict, const libantelope::wif_codec_t& codec);
|
||||||
|
|
||||||
virtual void onResult(const struct libeosio::ec_keypair* key, const struct KeySearch::result& result);
|
virtual void onResult(const struct libantelope::ec_keypair* key, const struct KeySearch::result& result);
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
const Dictionary& m_dict;
|
const Dictionary& m_dict;
|
||||||
|
|
||||||
libeosio::wif_codec_t m_codec;
|
libantelope::wif_codec_t m_codec;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace eoskeygen
|
} // namespace eoskeygen
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <CLI11/CLI11.hpp>
|
#include <CLI11/CLI11.hpp>
|
||||||
#include <libeosio/base58.hpp>
|
#include <libantelope/base58.hpp>
|
||||||
#include <libeosio/ec.hpp>
|
#include <libantelope/ec.hpp>
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
#include <eoskeygen/config.hpp>
|
#include <eoskeygen/config.hpp>
|
||||||
#include <eoskeygen/core/file.hpp>
|
#include <eoskeygen/core/file.hpp>
|
||||||
#include <eoskeygen/core/string.hpp>
|
#include <eoskeygen/core/string.hpp>
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
// Command line options.
|
// Command line options.
|
||||||
bool option_l33t = false;
|
bool option_l33t = false;
|
||||||
libeosio::wif_codec_t key_codec;
|
libantelope::wif_codec_t key_codec;
|
||||||
|
|
||||||
#ifdef EOSIOKEYGEN_HAVE_THREADS
|
#ifdef EOSIOKEYGEN_HAVE_THREADS
|
||||||
size_t option_num_threads;
|
size_t option_num_threads;
|
||||||
|
|
@ -71,7 +71,7 @@ int cmd_search(const eoskeygen::strlist_t& words, const eoskeygen::Dictionary& d
|
||||||
ks.setCallback(&rs);
|
ks.setCallback(&rs);
|
||||||
|
|
||||||
for(auto it = words.begin(); it != words.end(); it++) {
|
for(auto it = words.begin(); it != words.end(); it++) {
|
||||||
size_t p = libeosio::is_base58(*it);
|
size_t p = libantelope::is_base58(*it);
|
||||||
if (p != std::string::npos) {
|
if (p != std::string::npos) {
|
||||||
std::cerr << "The word '"
|
std::cerr << "The word '"
|
||||||
<< *it << "' contains an invalid non-base58 character '"
|
<< *it << "' contains an invalid non-base58 character '"
|
||||||
|
|
@ -128,7 +128,7 @@ int main(int argc, char **argv) {
|
||||||
size_t bench_count;
|
size_t bench_count;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
libeosio::ec_init();
|
libantelope::ec_init();
|
||||||
|
|
||||||
CLI::Option* version = cmd.add_flag("-v,--version", "Show version");
|
CLI::Option* version = cmd.add_flag("-v,--version", "Show version");
|
||||||
cmd.add_option("--format", key_format, "valid values: K1, fio, legacy")->default_val("K1");
|
cmd.add_option("--format", key_format, "valid values: K1, fio, legacy")->default_val("K1");
|
||||||
|
|
@ -174,11 +174,11 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key_format == "fio") {
|
if (key_format == "fio") {
|
||||||
key_codec = libeosio::wif_create_legacy_codec("FIO");
|
key_codec = libantelope::wif_create_legacy_codec("FIO");
|
||||||
} else if (key_format == "legacy") {
|
} else if (key_format == "legacy") {
|
||||||
key_codec = libeosio::WIF_CODEC_LEG;
|
key_codec = libantelope::WIF_CODEC_LEG;
|
||||||
} else if (key_format == "K1") {
|
} else if (key_format == "K1") {
|
||||||
key_codec = libeosio::WIF_CODEC_K1;
|
key_codec = libantelope::WIF_CODEC_K1;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "invalid key format: " << key_format << std::endl;
|
std::cerr << "invalid key format: " << key_format << std::endl;
|
||||||
goto end;
|
goto end;
|
||||||
|
|
@ -236,12 +236,12 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
// No subcommand given, just generate and print a keypair.
|
// No subcommand given, just generate and print a keypair.
|
||||||
else {
|
else {
|
||||||
struct libeosio::ec_keypair pair;
|
struct libantelope::ec_keypair pair;
|
||||||
libeosio::ec_generate_key(&pair);
|
libantelope::ec_generate_key(&pair);
|
||||||
libeosio::wif_print_key(&pair, key_codec);
|
libantelope::wif_print_key(&pair, key_codec);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
end: libeosio::ec_shutdown();
|
end: libantelope::ec_shutdown();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ add_library( ${COMMON_NAME} STATIC ${COMMON_SOURCE} )
|
||||||
|
|
||||||
target_include_directories( ${COMMON_NAME} PUBLIC include )
|
target_include_directories( ${COMMON_NAME} PUBLIC include )
|
||||||
|
|
||||||
# Link with libeosio and threads library.
|
# Link with libantelope and threads library.
|
||||||
include( libeosio )
|
include( libantelope )
|
||||||
target_link_libraries( ${COMMON_NAME}
|
target_link_libraries( ${COMMON_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
libeosio
|
libantelope
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
53
common/cmake/libantelope.cmake
Normal file
53
common/cmake/libantelope.cmake
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# --------------------------------
|
||||||
|
# Variables
|
||||||
|
# --------------------------------
|
||||||
|
set( LIBANTELOPE_GIT_URL "https://github.com/eosswedenorg/libantelope.git" )
|
||||||
|
set( LIBANTELOPE_WANTED_VERSION v0.2.0 )
|
||||||
|
|
||||||
|
# --------------------------------
|
||||||
|
# Macros
|
||||||
|
# --------------------------------
|
||||||
|
macro(fromGit tag)
|
||||||
|
|
||||||
|
message ("Using libantelope from: ${LIBANTELOPE_GIT_URL}@${tag}")
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(libantelope
|
||||||
|
GIT_REPOSITORY ${LIBANTELOPE_GIT_URL}
|
||||||
|
GIT_TAG ${tag}
|
||||||
|
SOURCE_DIR ${DOWNLOAD_CACHE_DIR}/libeosio/src
|
||||||
|
STAMP_DIR ${DOWNLOAD_CACHE_DIR}/libeosio/stamp
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(libantelope)
|
||||||
|
if (NOT libantelope_POPULATED)
|
||||||
|
FetchContent_Populate(libantelope)
|
||||||
|
add_subdirectory(${libantelope_SOURCE_DIR} ${libantelope_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(buildLocal src)
|
||||||
|
message ("Using local libantelope at: ${src}")
|
||||||
|
add_subdirectory(${src} ${src}/build EXCLUDE_FROM_ALL)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# If we have a local libantelope
|
||||||
|
if (LIBANTELOPE_SOURCE_DIR)
|
||||||
|
buildLocal( ${LIBANTELOPE_SOURCE_DIR} )
|
||||||
|
else()
|
||||||
|
|
||||||
|
# Check if version is in fact a version.
|
||||||
|
if (LIBANTELOPE_WANTED_VERSION MATCHES "^[0-9]+(.[0-9]+)?(.[0-9]+)(-[a-zA-Z0-9]+)?$")
|
||||||
|
# Try finding the package on the system.
|
||||||
|
find_package(libantelope ${LIBANTELOPE_WANTED_VERSION} QUIET)
|
||||||
|
if (libantelope_FOUND)
|
||||||
|
message ("Using libeosio in: ${libantelope_DIR}")
|
||||||
|
# Not found, download from git.
|
||||||
|
else()
|
||||||
|
fromGit( v${LIBANTELOPE_WANTED_VERSION} )
|
||||||
|
endif()
|
||||||
|
# Assume version contains a git branch.
|
||||||
|
else()
|
||||||
|
fromGit( ${LIBANTELOPE_WANTED_VERSION} )
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
# --------------------------------
|
|
||||||
# Variables
|
|
||||||
# --------------------------------
|
|
||||||
set( LIBEOSIO_GIT_URL "https://github.com/eosswedenorg/libeosio.git" )
|
|
||||||
set( LIBEOSIO_WANTED_VERSION v0.1.7 )
|
|
||||||
|
|
||||||
# --------------------------------
|
|
||||||
# Macros
|
|
||||||
# --------------------------------
|
|
||||||
macro(fromGit tag)
|
|
||||||
|
|
||||||
message ("Using libeosio from: ${LIBEOSIO_GIT_URL}@${tag}")
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(libeosio
|
|
||||||
GIT_REPOSITORY ${LIBEOSIO_GIT_URL}
|
|
||||||
GIT_TAG ${tag}
|
|
||||||
SOURCE_DIR ${DOWNLOAD_CACHE_DIR}/libeosio/src
|
|
||||||
STAMP_DIR ${DOWNLOAD_CACHE_DIR}/libeosio/stamp
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_GetProperties(libeosio)
|
|
||||||
if (NOT libeosio_POPULATED)
|
|
||||||
FetchContent_Populate(libeosio)
|
|
||||||
add_subdirectory(${libeosio_SOURCE_DIR} ${libeosio_BINARY_DIR} EXCLUDE_FROM_ALL)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(buildLocal src)
|
|
||||||
message ("Using local libeosio at: ${src}")
|
|
||||||
add_subdirectory(${src} ${src}/build EXCLUDE_FROM_ALL)
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# If we have a locallibeosio
|
|
||||||
if (LIBEOSIO_SOURCE_DIR)
|
|
||||||
buildLocal( ${LIBEOSIO_SOURCE_DIR} )
|
|
||||||
else()
|
|
||||||
|
|
||||||
# Check if version is in fact a version.
|
|
||||||
if (LIBEOSIO_WANTED_VERSION MATCHES "^[0-9]+(.[0-9]+)?(.[0-9]+)(-[a-zA-Z0-9]+)?$")
|
|
||||||
# Try finding the package on the system.
|
|
||||||
find_package(libeosio ${LIBEOSIO_WANTED_VERSION} QUIET)
|
|
||||||
if (libeoskeygen_FOUND)
|
|
||||||
message ("Using libeosio in: ${libeosio_DIR}")
|
|
||||||
# Not found, download from git.
|
|
||||||
else()
|
|
||||||
fromGit( v${LIBEOSIO_WANTED_VERSION} )
|
|
||||||
endif()
|
|
||||||
# Assume version contains a git branch.
|
|
||||||
else()
|
|
||||||
fromGit( ${LIBEOSIO_WANTED_VERSION} )
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <libeosio/ec.hpp>
|
#include <libantelope/ec.hpp>
|
||||||
#include <eoskeygen/config.hpp>
|
#include <eoskeygen/config.hpp>
|
||||||
#include <eoskeygen/core/dictionary.hpp>
|
#include <eoskeygen/core/dictionary.hpp>
|
||||||
#include <eoskeygen/core/strlist.hpp>
|
#include <eoskeygen/core/strlist.hpp>
|
||||||
|
|
@ -88,7 +88,7 @@ protected :
|
||||||
|
|
||||||
// Check if any word in <word_list> appears in <key>'s public key.
|
// Check if any word in <word_list> appears in <key>'s public key.
|
||||||
// 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 libeosio::ec_keypair* key, struct result& result);
|
bool _contains_word(const struct libantelope::ec_keypair* key, struct result& result);
|
||||||
|
|
||||||
#ifdef EOSIOKEYGEN_HAVE_THREADS
|
#ifdef EOSIOKEYGEN_HAVE_THREADS
|
||||||
void _thr_proc();
|
void _thr_proc();
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class IKeySearchResult
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
virtual void onResult(const struct libeosio::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 eoskeygen
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
*/
|
*/
|
||||||
#include <libeosio/ec.hpp>
|
#include <libantelope/ec.hpp>
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
#include <eoskeygen/config.hpp>
|
#include <eoskeygen/config.hpp>
|
||||||
#include <eoskeygen/core/string.hpp>
|
#include <eoskeygen/core/string.hpp>
|
||||||
#include <eoskeygen/key_search_result.hpp>
|
#include <eoskeygen/key_search_result.hpp>
|
||||||
|
|
@ -77,11 +77,11 @@ void KeySearch::setCallback(IKeySearchResult* callback)
|
||||||
|
|
||||||
void KeySearch::_search_linear()
|
void KeySearch::_search_linear()
|
||||||
{
|
{
|
||||||
struct libeosio::ec_keypair pair;
|
struct libantelope::ec_keypair pair;
|
||||||
|
|
||||||
while (m_count < m_max) {
|
while (m_count < m_max) {
|
||||||
struct result res;
|
struct result res;
|
||||||
libeosio::ec_generate_key(&pair);
|
libantelope::ec_generate_key(&pair);
|
||||||
if (_contains_word(&pair, res)) {
|
if (_contains_word(&pair, res)) {
|
||||||
m_callback->onResult(&pair, res);
|
m_callback->onResult(&pair, res);
|
||||||
m_count++;
|
m_count++;
|
||||||
|
|
@ -111,10 +111,10 @@ void KeySearch::find(size_t num_results)
|
||||||
_search_linear();
|
_search_linear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeySearch::_contains_word(const struct libeosio::ec_keypair* key, struct result& result) {
|
bool KeySearch::_contains_word(const struct libantelope::ec_keypair* key, struct result& result) {
|
||||||
|
|
||||||
size_t prefix_len = m_prefix.length();
|
size_t prefix_len = m_prefix.length();
|
||||||
std::string pubstr = libeosio::wif_pub_encode(key->pub, m_prefix).substr(prefix_len);
|
std::string pubstr = libantelope::wif_pub_encode(key->pub, m_prefix).substr(prefix_len);
|
||||||
strtolower(pubstr);
|
strtolower(pubstr);
|
||||||
|
|
||||||
for(auto const& w: m_words) {
|
for(auto const& w: m_words) {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <libeosio/ec.hpp>
|
#include <libantelope/ec.hpp>
|
||||||
#include <eoskeygen/key_search_result.hpp>
|
#include <eoskeygen/key_search_result.hpp>
|
||||||
#include <eoskeygen/key_search.hpp>
|
#include <eoskeygen/key_search.hpp>
|
||||||
|
|
||||||
|
|
@ -37,12 +37,12 @@ std::mutex g_count_mtx;
|
||||||
// Thread process.
|
// Thread process.
|
||||||
void KeySearch::_thr_proc()
|
void KeySearch::_thr_proc()
|
||||||
{
|
{
|
||||||
struct libeosio::ec_keypair pair;
|
struct libantelope::ec_keypair pair;
|
||||||
|
|
||||||
while (m_count < m_max) {
|
while (m_count < m_max) {
|
||||||
struct result res;
|
struct result res;
|
||||||
|
|
||||||
libeosio::ec_generate_key(&pair);
|
libantelope::ec_generate_key(&pair);
|
||||||
if (_contains_word(&pair, res)) {
|
if (_contains_word(&pair, res)) {
|
||||||
|
|
||||||
// Guard output with mutex, so we don't get
|
// Guard output with mutex, so we don't get
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <libeosio/ec.hpp>
|
#include <libantelope/ec.hpp>
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
#include "Settings.hpp"
|
#include "Settings.hpp"
|
||||||
#include "GenerateWindow.hpp"
|
#include "GenerateWindow.hpp"
|
||||||
|
|
||||||
|
|
@ -98,13 +98,13 @@ m_btn_copy_both ("Copy keys")
|
||||||
void GenerateWindow::generate_key()
|
void GenerateWindow::generate_key()
|
||||||
{
|
{
|
||||||
std::string pubstr, pvtstr;
|
std::string pubstr, pvtstr;
|
||||||
struct libeosio::ec_keypair pair;
|
struct libantelope::ec_keypair pair;
|
||||||
const libeosio::wif_codec_t& codec = Settings::getKeyCodec();
|
const libantelope::wif_codec_t& codec = Settings::getKeyCodec();
|
||||||
|
|
||||||
libeosio::ec_generate_key(&pair);
|
libantelope::ec_generate_key(&pair);
|
||||||
|
|
||||||
pubstr = libeosio::wif_pub_encode(pair.pub, codec.pub);
|
pubstr = libantelope::wif_pub_encode(pair.pub, codec.pub);
|
||||||
pvtstr = libeosio::wif_priv_encode(pair.secret, codec.pvt);
|
pvtstr = libantelope::wif_priv_encode(pair.secret, codec.pvt);
|
||||||
m_pub.setText(QString::fromStdString(pubstr));
|
m_pub.setText(QString::fromStdString(pubstr));
|
||||||
m_priv.setText(QString::fromStdString(pvtstr));
|
m_priv.setText(QString::fromStdString(pvtstr));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
#include "gui_text.h"
|
#include "gui_text.h"
|
||||||
#include "Settings.hpp"
|
#include "Settings.hpp"
|
||||||
#include "GenerateWindow.hpp"
|
#include "GenerateWindow.hpp"
|
||||||
|
|
@ -38,7 +38,7 @@ m_format_fio_action (nullptr),
|
||||||
m_format_legacy_action (nullptr),
|
m_format_legacy_action (nullptr),
|
||||||
m_format_k1_action (nullptr)
|
m_format_k1_action (nullptr)
|
||||||
{
|
{
|
||||||
libeosio::ec_init();
|
libantelope::ec_init();
|
||||||
|
|
||||||
// Create sub windows and stacked widget.
|
// Create sub windows and stacked widget.
|
||||||
m_stacked = new QStackedWidget();
|
m_stacked = new QStackedWidget();
|
||||||
|
|
@ -83,7 +83,7 @@ m_format_k1_action (nullptr)
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
libeosio::ec_shutdown();
|
libantelope::ec_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::switchToGenerate()
|
void MainWindow::switchToGenerate()
|
||||||
|
|
@ -106,20 +106,20 @@ void MainWindow::showAbout()
|
||||||
void MainWindow::formatFioCheckboxChanged()
|
void MainWindow::formatFioCheckboxChanged()
|
||||||
{
|
{
|
||||||
if (m_format_fio_action->isChecked()) {
|
if (m_format_fio_action->isChecked()) {
|
||||||
Settings::setKeyCodec(libeosio::wif_create_legacy_codec("FIO"));
|
Settings::setKeyCodec(libantelope::wif_create_legacy_codec("FIO"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::formatLegacyCheckboxChanged()
|
void MainWindow::formatLegacyCheckboxChanged()
|
||||||
{
|
{
|
||||||
if (m_format_legacy_action->isChecked()) {
|
if (m_format_legacy_action->isChecked()) {
|
||||||
Settings::setKeyCodec(libeosio::WIF_CODEC_LEG);
|
Settings::setKeyCodec(libantelope::WIF_CODEC_LEG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::formatK1CheckboxChanged()
|
void MainWindow::formatK1CheckboxChanged()
|
||||||
{
|
{
|
||||||
if (m_format_k1_action->isChecked()) {
|
if (m_format_k1_action->isChecked()) {
|
||||||
Settings::setKeyCodec(libeosio::WIF_CODEC_K1);
|
Settings::setKeyCodec(libantelope::WIF_CODEC_K1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
#include <eoskeygen/core/leet.hpp>
|
#include <eoskeygen/core/leet.hpp>
|
||||||
#include <eoskeygen/core/string.hpp>
|
#include <eoskeygen/core/string.hpp>
|
||||||
#include "Settings.hpp"
|
#include "Settings.hpp"
|
||||||
|
|
@ -146,12 +146,12 @@ void SearchWindow::loadDictionaries()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchWindow::onResult(const struct libeosio::ec_keypair* key, const struct eoskeygen::KeySearch::result& result)
|
void SearchWindow::onResult(const struct libantelope::ec_keypair* key, const struct eoskeygen::KeySearch::result& result)
|
||||||
{
|
{
|
||||||
int pos = (int) result.pos;
|
int pos = (int) result.pos;
|
||||||
int len = (int) result.len;
|
int len = (int) result.len;
|
||||||
libeosio::wif_codec_t codec = Settings::getKeyCodec();
|
libantelope::wif_codec_t codec = Settings::getKeyCodec();
|
||||||
QString pub = QString::fromStdString(libeosio::wif_pub_encode(key->pub, codec.pub));
|
QString pub = QString::fromStdString(libantelope::wif_pub_encode(key->pub, codec.pub));
|
||||||
int pub_prefix_len = (int) codec.pub.length();
|
int pub_prefix_len = (int) codec.pub.length();
|
||||||
QString mid = pub.mid(pos, len);
|
QString mid = pub.mid(pos, len);
|
||||||
QString left = pub.left(pos);
|
QString left = pub.left(pos);
|
||||||
|
|
@ -180,7 +180,7 @@ void SearchWindow::onResult(const struct libeosio::ec_keypair* key, const struct
|
||||||
out += pub[i++];
|
out += pub[i++];
|
||||||
}
|
}
|
||||||
|
|
||||||
out += "<br/>Private: " + QString::fromStdString(libeosio::wif_priv_encode(key->secret, codec.pvt));
|
out += "<br/>Private: " + QString::fromStdString(libantelope::wif_priv_encode(key->secret, codec.pvt));
|
||||||
|
|
||||||
// As this function could be called from a non-gui thread. we use signals.
|
// As this function could be called from a non-gui thread. we use signals.
|
||||||
emit addOutput("<p>" + out + "</p>");
|
emit addOutput("<p>" + out + "</p>");
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class SearchWindow : public QWidget, public eoskeygen::IKeySearchResult
|
||||||
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 libeosio::ec_keypair* key, const struct eoskeygen::KeySearch::result& result);
|
void onResult(const struct libantelope::ec_keypair* key, const struct eoskeygen::KeySearch::result& result);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
void initSignals();
|
void initSignals();
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@
|
||||||
|
|
||||||
namespace priv {
|
namespace priv {
|
||||||
|
|
||||||
libeosio::wif_codec_t key_format = libeosio::WIF_CODEC_K1;
|
libantelope::wif_codec_t key_format = libantelope::WIF_CODEC_K1;
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
|
||||||
void Settings::setKeyCodec(const libeosio::wif_codec_t& format) {
|
void Settings::setKeyCodec(const libantelope::wif_codec_t& format) {
|
||||||
priv::key_format = format;
|
priv::key_format = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
const libeosio::wif_codec_t& Settings::getKeyCodec() {
|
const libantelope::wif_codec_t& Settings::getKeyCodec() {
|
||||||
return priv::key_format;
|
return priv::key_format;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@
|
||||||
#ifndef SETTINGS_H
|
#ifndef SETTINGS_H
|
||||||
#define SETTINGS_H
|
#define SETTINGS_H
|
||||||
|
|
||||||
#include <libeosio/WIF.hpp>
|
#include <libantelope/WIF.hpp>
|
||||||
|
|
||||||
namespace Settings
|
namespace Settings
|
||||||
{
|
{
|
||||||
void setKeyCodec(const libeosio::wif_codec_t& format);
|
void setKeyCodec(const libantelope::wif_codec_t& format);
|
||||||
|
|
||||||
const libeosio::wif_codec_t& getKeyCodec();
|
const libantelope::wif_codec_t& getKeyCodec();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SEARCH_WINDOW_H */
|
#endif /* SEARCH_WINDOW_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue