mirror of
https://github.com/monero-project/monero.git
synced 2025-12-26 04:42:01 -08:00
wallet: add encrypted seed functionality
This uses luigi1111's CN_Add method. See https://xmr.llcoins.net for details.
This commit is contained in:
@@ -869,4 +869,21 @@ namespace cryptonote
|
||||
block_hashes_calculated = block_hashes_calculated_count;
|
||||
block_hashes_cached = block_hashes_cached_count;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
crypto::secret_key encrypt_key(const crypto::secret_key &key, const std::string &passphrase)
|
||||
{
|
||||
crypto::hash hash;
|
||||
crypto::cn_slow_hash(passphrase.data(), passphrase.size(), hash);
|
||||
sc_add((unsigned char*)key.data, (const unsigned char*)key.data, (const unsigned char*)hash.data);
|
||||
return key;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
crypto::secret_key decrypt_key(const crypto::secret_key &key, const std::string &passphrase)
|
||||
{
|
||||
crypto::hash hash;
|
||||
crypto::cn_slow_hash(passphrase.data(), passphrase.size(), hash);
|
||||
sc_sub((unsigned char*)key.data, (const unsigned char*)key.data, (const unsigned char*)hash.data);
|
||||
return key;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user