mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-06-18 04:00:03 +02:00
refactor struct key_search_result from src/key_search_helpers.h to include/eoskeygen/key_search.h
This commit is contained in:
parent
8035e3233c
commit
a417390bb7
5 changed files with 36 additions and 32 deletions
|
|
@ -37,7 +37,7 @@ static size_t highlight(console::Color color, const std::string& str, size_t pos
|
|||
return len;
|
||||
}
|
||||
|
||||
void key_search_result(const struct ec_keypair* key, const struct key_result* result, const Dictionary& dict) {
|
||||
void key_search_result(const struct ec_keypair* key, const struct KeySearch::result* result, const Dictionary& dict) {
|
||||
|
||||
std::string pub = wif_pub_encode(key->pub);
|
||||
Dictionary::search_result_t dict_res = dict.search(pub);
|
||||
|
|
@ -66,21 +66,4 @@ void key_search_result(const struct ec_keypair* key, const struct key_result* re
|
|||
<< "Private: " << wif_priv_encode(key->secret) << std::endl;
|
||||
}
|
||||
|
||||
bool key_contains_word(const struct ec_keypair* key, const strlist_t& word_list, struct key_result *result) {
|
||||
|
||||
// skip first 3 chars, as those are always "EOS"
|
||||
std::string pubstr = wif_pub_encode(key->pub).substr(3);
|
||||
strtolower(pubstr);
|
||||
|
||||
for(auto const& w: word_list) {
|
||||
size_t p = pubstr.find(w);
|
||||
if (p != std::string::npos) {
|
||||
result->pos = p + 3;
|
||||
result->len = w.length();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace eoskeygen
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue