Add standard ToString representation of hash

This commit is contained in:
Seth Hillbrand 2024-06-25 18:34:57 -07:00
parent a9d9d7ac06
commit 0a55ca5e96
1 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,8 @@
#define HASH_128_H_ #define HASH_128_H_
#include <cstdint> #include <cstdint>
#include <iomanip>
#include <sstream>
/** /**
* A storage class for 128-bit hash value * A storage class for 128-bit hash value
@ -42,6 +44,15 @@ struct HASH_128
return memcmp( Value64, aOther.Value64, sizeof( Value64 ) ) == 0; return memcmp( Value64, aOther.Value64, sizeof( Value64 ) ) == 0;
} }
std::string ToString() const
{
std::stringstream ss;
ss << std::hex << std::uppercase << std::setfill( '0' )
<< std::setw( 16 ) << Value64[0]
<< std::setw( 16 ) << Value64[1];
return ss.str();
}
public: public:
union union
{ {