#define BITCOIN_UINT256_H
#include <limits>
-#include <string.h>
#include <string>
#include <vector>
-#include <stdint.h>
+#include <iomanip>
+#include <sstream>
using namespace std;
std::string GetHex() const
{
- char psz[sizeof(pn)*2 + 1];
- for (unsigned int i = 0; i < sizeof(pn); i++)
- sprintf(psz + i*2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]);
- return std::string(psz, psz + sizeof(pn)*2);
+ std::stringstream ss;
+ size_t pn_size = sizeof(pn) / sizeof(pn[0]);
+ for (size_t i = 1; i <= pn_size; i++)
+ ss << std::setfill('0') << std::setw(8) << std::setbase(16) << pn[pn_size-i];
+ return ss.str();
}
void SetHex(const char* psz)