diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-12 23:11:51 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-28 21:30:28 +0100 |
commit | 074e60260919fb0da19db125f3c9a16bcff2773f (patch) | |
tree | 5979cc83e22bbdb46feb2a09608f89817d00e701 | |
parent | New "Halfway RingCT" outputs for coinbase transactions (diff) | |
download | monero-074e60260919fb0da19db125f3c9a16bcff2773f.tar.xz |
ringct: use Cryptonote serialization to hash non prunable data
-rw-r--r-- | src/ringct/rctSigs.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index 62ac2ac06..348051419 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -30,6 +30,8 @@ #include "misc_log_ex.h" #include "rctSigs.h" +#include "cryptonote_core/cryptonote_format_utils.h" + using namespace crypto; using namespace std; @@ -343,9 +345,12 @@ namespace rct { key get_pre_mlsag_hash(const rctSig &rv) { + keyV hashes; + hashes.push_back(rv.message); + crypto::hash h; + cryptonote::get_blob_hash(cryptonote::t_serializable_object_to_blob((const rctSigBase&)rv), h); + hashes.push_back(hash2rct(h)); keyV kv; - kv.push_back(d2h(rv.type)); - kv.push_back(rv.message); for (auto r: rv.p.rangeSigs) { for (size_t n = 0; n < 64; ++n) @@ -356,26 +361,9 @@ namespace rct { for (size_t n = 0; n < 64; ++n) kv.push_back(r.Ci[n]); } - // no MG/MGs, that's what will sign all this - // no mixRing, it's part of the vin already - for (auto o: rv.pseudoOuts) - { - kv.push_back(o); - } - for (auto i: rv.ecdhInfo) - { - kv.push_back(i.mask); - kv.push_back(i.amount); - // no senderPk, unused here - } - for (auto o: rv.outPk) - { - kv.push_back(o.dest); - kv.push_back(o.mask); - } - kv.push_back(d2h(rv.txnFee)); + hashes.push_back(cn_fast_hash(kv)); - return cn_fast_hash(kv); + return cn_fast_hash(hashes); } //Ring-ct MG sigs |