aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-06-10 20:15:01 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:28:20 +0100
commit789b2e21f6019f65e86f2e295c0f901b1524bff1 (patch)
tree1e40c54ea668444068393949bf5a6af68036dac9
parentcore: link against libringct (diff)
downloadmonero-789b2e21f6019f65e86f2e295c0f901b1524bff1.tar.xz
ringct: add more convenience functions
-rw-r--r--src/ringct/rctTypes.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h
index 8be69021b..21bcf4da2 100644
--- a/src/ringct/rctTypes.h
+++ b/src/ringct/rctTypes.h
@@ -288,10 +288,20 @@ namespace rct {
//int[64] to uint long long
xmr_amount b2d(bits amountb);
- static inline bool operator==(const key &k0, const public_key &k1) { return !memcmp(&k0, &k1, 32); }
- static inline bool operator==(const public_key &k0, const key &k1) { return !memcmp(&k0, &k1, 32); }
- static inline key pk2rct(const public_key &pk) { key k; memcpy(&k, &pk, 32); return k; }
- static inline public_key rct2pk(const key &k) { public_key pk; memcpy(&pk, &k, 32); return pk; }
+ static inline rct::key pk2rct(const crypto::public_key &pk) { rct::key k; memcpy(&k, &pk, 32); return k; }
+ static inline rct::key sk2rct(const crypto::secret_key &sk) { rct::key k; memcpy(&k, &sk, 32); return k; }
+ static inline rct::key ki2rct(const crypto::key_image &ki) { rct::key k; memcpy(&k, &ki, 32); return k; }
+ static inline crypto::public_key rct2pk(const rct::key &k) { crypto::public_key pk; memcpy(&pk, &k, 32); return pk; }
+ static inline crypto::secret_key rct2sk(const rct::key &k) { crypto::secret_key sk; memcpy(&sk, &k, 32); return sk; }
+ static inline crypto::key_image rct2ki(const rct::key &k) { crypto::key_image ki; memcpy(&ki, &k, 32); return ki; }
+ static inline bool operator==(const rct::key &k0, const crypto::public_key &k1) { return !memcmp(&k0, &k1, 32); }
+ static inline bool operator!=(const rct::key &k0, const crypto::public_key &k1) { return memcmp(&k0, &k1, 32); }
+}
+
+
+namespace cryptonote {
+ static inline bool operator==(const crypto::public_key &k0, const rct::key &k1) { return !memcmp(&k0, &k1, 32); }
+ static inline bool operator!=(const crypto::public_key &k0, const rct::key &k1) { return memcmp(&k0, &k1, 32); }
}
template<typename T> std::ostream &print256(std::ostream &o, const T &v);