Add standard ToString representation of hash
This commit is contained in:
parent
a9d9d7ac06
commit
0a55ca5e96
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue