diff options
author | monero-project <sempre.amaro@gmail.com> | 2014-06-12 19:41:37 -0400 |
---|---|---|
committer | monero-project <sempre.amaro@gmail.com> | 2014-06-12 19:41:37 -0400 |
commit | 5489112b11fb44cfe03ce99b63dc92b3e68f8be5 (patch) | |
tree | 73da392fe51b1421aa17a97b4d8ff650904ef3ff | |
parent | Merge pull request #34 from tewinget/master (diff) | |
parent | changed wallet mnemonic to use cout so it doesn't print to log (diff) | |
download | monero-5489112b11fb44cfe03ce99b63dc92b3e68f8be5.tar.xz |
Merge pull request #35 from tewinget/master
Add electrum-seed wallet backup/recovery 2
-rw-r--r-- | src/cryptonote_core/account.cpp | 4 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 22 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/cryptonote_core/account.cpp b/src/cryptonote_core/account.cpp index 7da1c6745..3bedd7404 100644 --- a/src/cryptonote_core/account.cpp +++ b/src/cryptonote_core/account.cpp @@ -12,7 +12,7 @@ #include "crypto/crypto.h" extern "C" { -#include "crypto/blake256.h" +#include "crypto/keccak.h" } #include "cryptonote_core/cryptonote_basic_impl.h" #include "cryptonote_core/cryptonote_format_utils.h" @@ -39,7 +39,7 @@ DISABLE_VS_WARNINGS(4244 4345) // rng for generating second set of keys is hash of first rng. means only one set of electrum-style words needed for recovery crypto::secret_key second; - blake256_hash((uint8_t *)&second, (uint8_t *)&first, sizeof(crypto::secret_key)); + keccak((uint8_t *)&first, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key)); generate_keys(m_keys.m_account_address.m_view_public_key, m_keys.m_view_secret_key, second, two_random ? false : true); m_creation_timestamp = time(NULL); diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 95d163f2e..6af0de9f9 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <thread> +#include <iostream> #include <boost/lexical_cast.hpp> #include <boost/program_options.hpp> #include <boost/algorithm/string.hpp> @@ -42,7 +43,7 @@ namespace const command_line::arg_descriptor<std::string> arg_password = {"password", "Wallet password", "", true}; const command_line::arg_descriptor<std::string> arg_electrum_seed = {"electrum-seed", "Specify electrum seed for wallet recovery/creation", ""}; const command_line::arg_descriptor<bool> arg_restore_deterministic_wallet = {"restore-deterministic-wallet", "Recover wallet using electrum-style mnemonic", false}; - const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", "requires --generate-new-wallet, uses old generation method", false}; + const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", "creates non-deterministic view and spend keys", false}; const command_line::arg_descriptor<int> arg_daemon_port = {"daemon-port", "Use daemon instance at port <arg> instead of 8081", 0}; const command_line::arg_descriptor<uint32_t> arg_log_level = {"set_log", "", 0, true}; @@ -397,12 +398,6 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas std::string print_electrum = ""; - if (!two_random) - { - print_electrum = "\nYour wallet can be recovered using the following electrum-style word list:\n"; - print_electrum += electrum_words; - print_electrum += "\n"; - } success_msg_writer() << "**********************************************************************\n" << @@ -411,9 +406,16 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas "Use \"help\" command to see the list of available commands.\n" << "Always use \"exit\" command when closing simplewallet to save\n" << "current session's state. Otherwise, you will possibly need to synchronize \n" << - "your wallet again. Your wallet key is NOT under risk anyway.\n" << - print_electrum << - "**********************************************************************"; + "your wallet again. Your wallet key is NOT under risk anyway.\n" + ; + + if (!two_random) + { + success_msg_writer(true) << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control. You will not be able to view these words again, so it is imperative to make note of them now.\n"; + std::cout << electrum_words << std::endl; + } + success_msg_writer() << "**********************************************************************"; + return true; } //---------------------------------------------------------------------------------------------------- |