Is there any obvious gain to using epee in the crypto module?
I don't know why this code is inside crypto instead of cryptonote:
inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) {
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
}
inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) {
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
}
inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) {
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
}
inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) {
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
}
inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) {
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
}
It is a way to convert data to hex, so why is this part of the crypto module?
And maybe a template function can do the job:
template <typename T> std::ostream &operator <<(std::ostream &o, T &v) {
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
}
As we know public_key and private_key are parts of cryptonote not crypto. So why should this code be put into the crypto module?
To my understanding, the crypto module only cares about hashing. Am I wrong?