mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-06-18 04:00:03 +02:00
src/key_search_helpers.cpp: add key_contains_word()
This commit is contained in:
parent
1c3d503369
commit
bae3721211
2 changed files with 19 additions and 1 deletions
|
|
@ -9,3 +9,17 @@ void key_search_result(const std::string& word, const struct ec_keypair* pair) {
|
|||
std::cout << "Found: " << word << std::endl;
|
||||
wif_print_key(pair);
|
||||
}
|
||||
|
||||
bool key_contains_word(const struct ec_keypair* key, const strlist_t& word_list, std::string& word) {
|
||||
|
||||
std::string 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,13 @@
|
|||
#ifndef KEY_SEARCH_HELPSER_H
|
||||
#define KEY_SEARCH_HELPERS_H
|
||||
|
||||
#include <string>
|
||||
#include "string.h"
|
||||
#include "ec.h"
|
||||
|
||||
void key_search_result(const std::string& word, const struct ec_keypair* pair);
|
||||
|
||||
// Check if any word in <word_list> appears in <key>'s public key.
|
||||
// returns true if a word was found (stored in <word>), false otherwise.
|
||||
bool key_contains_word(const struct ec_keypair* key, const strlist_t& word_list, std::string& word);
|
||||
|
||||
#endif /* KEY_SEARCH_HELPERS_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue