diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-08-15 17:44:34 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-08-15 17:44:34 -0500 |
commit | b82bcdea2d934db7b8bc0fa618d8a829875516f5 (patch) | |
tree | 176f1fc6b77aeb70cf5c6773efb12e3e49863976 /tests/unit_tests/ringdb.cpp | |
parent | Merge pull request #4177 (diff) | |
parent | unit_tests: use valid key images, pub keys, etc (diff) | |
download | monero-b82bcdea2d934db7b8bc0fa618d8a829875516f5.tar.xz |
Merge pull request #4186
c8226ad unit_tests: use valid key images, pub keys, etc (moneromooo-monero)
Diffstat (limited to 'tests/unit_tests/ringdb.cpp')
-rw-r--r-- | tests/unit_tests/ringdb.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/unit_tests/ringdb.cpp b/tests/unit_tests/ringdb.cpp index ef954fda2..8b0ea10d4 100644 --- a/tests/unit_tests/ringdb.cpp +++ b/tests/unit_tests/ringdb.cpp @@ -39,25 +39,29 @@ #include "crypto/crypto.h" #include "crypto/random.h" #include "crypto/chacha.h" +#include "ringct/rctOps.h" +#include "cryptonote_basic/cryptonote_basic.h" #include "wallet/ringdb.h" static crypto::chacha_key generate_chacha_key() { - uint8_t key[CHACHA_KEY_SIZE]; - crypto::rand(CHACHA_KEY_SIZE, key); crypto::chacha_key chacha_key; - memcpy(&chacha_key, key, CHACHA_KEY_SIZE); + uint64_t password = crypto::rand<uint64_t>(); + crypto::generate_chacha_key(std::string((const char*)&password, sizeof(password)), chacha_key); return chacha_key; } static crypto::key_image generate_key_image() { - return crypto::rand<crypto::key_image>(); + crypto::key_image key_image; + cryptonote::keypair keypair = cryptonote::keypair::generate(hw::get_device("default")); + crypto::generate_key_image(keypair.pub, keypair.sec, key_image); + return key_image; } static crypto::public_key generate_output() { - return crypto::rand<crypto::public_key>(); + return rct::rct2pk(rct::scalarmultBase(rct::skGen())); } |