1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-keygen synced 2026-06-18 04:00:03 +02:00

Move print_key() from main.cpp to WIF module (named wif_print_key)

This commit is contained in:
Henrik Hautakoski 2020-01-09 06:34:32 +01:00
parent 76e3d11747
commit 8ae7a24e27
3 changed files with 11 additions and 8 deletions

View file

@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <iostream>
#include <string.h>
#include "base58.h"
#include "checksum.h"
@ -50,3 +51,9 @@ std::string wif_pub_encode(ec_pubkey_t pub) {
return "EOS" + base58_encode(buf, buf + sizeof(buf));
}
void wif_print_key(struct ec_keypair *key) {
std::cout << "Private: " << wif_priv_encode(key->secret) << std::endl;
std::cout << "Public: " << wif_pub_encode(key->pub) << std::endl;
}

View file

@ -31,4 +31,6 @@ std::string wif_priv_encode(ec_privkey_t priv);
std::string wif_pub_encode(ec_pubkey_t pub);
void wif_print_key(struct ec_keypair *key);
#endif /* WIF_H */

View file

@ -29,12 +29,6 @@
#include "WIF.h"
#include "ec.h"
static void print_key(struct ec_keypair *key) {
std::cout << "Private: " << wif_priv_encode(key->secret) << std::endl;
std::cout << "Public: " << wif_pub_encode(key->pub) << std::endl;
}
static void search(const char *words, size_t n) {
size_t count = 0;
@ -57,7 +51,7 @@ static void search(const char *words, size_t n) {
if (pubstr.find(word) != std::string::npos) {
std::cout << "----" << std::endl;
std::cout << "Found: " << word << std::endl;
print_key(&pair);
wif_print_key(&pair);
count++;
}
}
@ -76,7 +70,7 @@ int main(int argc, char **argv) {
} else {
struct ec_keypair pair;
ec_generate_key(&pair);
print_key(&pair);
wif_print_key(&pair);
}
return 0;