From a4dec2e39b48a3f9bfa5de9aa92369711718b788 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 10 Jan 2020 10:40:28 +0100 Subject: [PATCH] src/key_search.h: remove key_search() it does not make sense and key_contains_word() can be used instead. --- src/key_search.cpp | 20 ++------------------ src/key_search.h | 2 -- src/key_search_nt.cpp | 3 ++- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/key_search.cpp b/src/key_search.cpp index 8dfe10e..cc2faf6 100644 --- a/src/key_search.cpp +++ b/src/key_search.cpp @@ -5,23 +5,6 @@ #include "key_search_helpers.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) { size_t count = 0; @@ -29,7 +12,8 @@ void key_search_n(const strlist_t& word_list, size_t n) { while (count < n) { 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); count++; } diff --git a/src/key_search.h b/src/key_search.h index b147b92..f6a77e2 100644 --- a/src/key_search.h +++ b/src/key_search.h @@ -27,8 +27,6 @@ #include "string.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); #ifdef HAVE_THREADS diff --git a/src/key_search_nt.cpp b/src/key_search_nt.cpp index 73738d7..c1b1b23 100644 --- a/src/key_search_nt.cpp +++ b/src/key_search_nt.cpp @@ -22,7 +22,8 @@ static void thr_proc(const strlist_t& word_list) { while (g_count < g_max) { 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 // interrupted mid write and can write to g_count safely.