mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-07-04 12:03:41 +02:00
src/key_search.h: remove key_search() it does not make sense and key_contains_word() can be used instead.
This commit is contained in:
parent
bae3721211
commit
a4dec2e39b
3 changed files with 4 additions and 21 deletions
|
|
@ -5,23 +5,6 @@
|
||||||
#include "key_search_helpers.h"
|
#include "key_search_helpers.h"
|
||||||
#include "key_search.h"
|
#include "key_search.h"
|
||||||
|
|
||||||
bool key_search(struct ec_keypair* key, std::string& word, const strlist_t& word_list) {
|
|
||||||
|
|
||||||
std::string pubstr;
|
|
||||||
|
|
||||||
ec_generate_key(key);
|
|
||||||
pubstr = wif_pub_encode(key->pub);
|
|
||||||
strtolower(pubstr);
|
|
||||||
|
|
||||||
for(auto const& w: word_list) {
|
|
||||||
if (pubstr.find(w) != std::string::npos) {
|
|
||||||
word = w;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void key_search_n(const strlist_t& word_list, size_t n) {
|
void key_search_n(const strlist_t& word_list, size_t n) {
|
||||||
|
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
@ -29,7 +12,8 @@ void key_search_n(const strlist_t& word_list, size_t n) {
|
||||||
|
|
||||||
while (count < n) {
|
while (count < n) {
|
||||||
std::string word;
|
std::string word;
|
||||||
if (key_search(&pair, word, word_list)) {
|
ec_generate_key(&pair);
|
||||||
|
if (key_contains_word(&pair, word_list, word)) {
|
||||||
key_search_result(word, &pair);
|
key_search_result(word, &pair);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "ec.h"
|
#include "ec.h"
|
||||||
|
|
||||||
bool key_search(struct ec_keypair* out, std::string& word, const strlist_t& word_list);
|
|
||||||
|
|
||||||
void key_search_n(const strlist_t& word_list, size_t n);
|
void key_search_n(const strlist_t& word_list, size_t n);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ static void thr_proc(const strlist_t& word_list) {
|
||||||
while (g_count < g_max) {
|
while (g_count < g_max) {
|
||||||
std::string word;
|
std::string word;
|
||||||
|
|
||||||
if (key_search(&pair, word, word_list)) {
|
ec_generate_key(&pair);
|
||||||
|
if (key_contains_word(&pair, word_list, word)) {
|
||||||
|
|
||||||
// Guard output with mutex, so we don't get
|
// Guard output with mutex, so we don't get
|
||||||
// interrupted mid write and can write to g_count safely.
|
// interrupted mid write and can write to g_count safely.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue