aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/ringdb.cpp
diff options
context:
space:
mode:
authorSarang Noether <32460187+SarangNoether@users.noreply.github.com>2020-04-01 08:31:00 -0400
committerSarang Noether <32460187+SarangNoether@users.noreply.github.com>2020-04-01 08:31:00 -0400
commit80d5320fff9c948f54b4379f3c2f3bc684e7f356 (patch)
treebe950820fe376cd19e8a5349680f24ffb62adb36 /src/wallet/ringdb.cpp
parentMerge pull request #6336 (diff)
downloadmonero-80d5320fff9c948f54b4379f3c2f3bc684e7f356.tar.xz
Hash domain separation
Diffstat (limited to 'src/wallet/ringdb.cpp')
-rw-r--r--src/wallet/ringdb.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/wallet/ringdb.cpp b/src/wallet/ringdb.cpp
index 5e88ea788..dfeb987ca 100644
--- a/src/wallet/ringdb.cpp
+++ b/src/wallet/ringdb.cpp
@@ -35,6 +35,7 @@
#include "misc_language.h"
#include "wallet_errors.h"
#include "ringdb.h"
+#include "cryptonote_config.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "wallet.ringdb"
@@ -105,13 +106,11 @@ std::string get_rings_filename(boost::filesystem::path filename)
static crypto::chacha_iv make_iv(const crypto::key_image &key_image, const crypto::chacha_key &key, uint8_t field)
{
- static const char salt[] = "ringdsb";
-
- uint8_t buffer[sizeof(key_image) + sizeof(key) + sizeof(salt) + sizeof(field)];
+ uint8_t buffer[sizeof(key_image) + sizeof(key) + sizeof(config::HASH_KEY_RINGDB) + sizeof(field)];
memcpy(buffer, &key_image, sizeof(key_image));
memcpy(buffer + sizeof(key_image), &key, sizeof(key));
- memcpy(buffer + sizeof(key_image) + sizeof(key), salt, sizeof(salt));
- memcpy(buffer + sizeof(key_image) + sizeof(key) + sizeof(salt), &field, sizeof(field));
+ memcpy(buffer + sizeof(key_image) + sizeof(key), config::HASH_KEY_RINGDB, sizeof(config::HASH_KEY_RINGDB));
+ memcpy(buffer + sizeof(key_image) + sizeof(key) + sizeof(config::HASH_KEY_RINGDB), &field, sizeof(field));
crypto::hash hash;
// if field is 0, backward compat mode: hash without the field
crypto::cn_fast_hash(buffer, sizeof(buffer) - !field, hash.data);