Identify which hashes we're using.

This commit is contained in:
JoelKatz
2011-12-05 13:21:52 -08:00
parent c220e6bcfc
commit f7d1539df4
3 changed files with 7 additions and 7 deletions

View File

@@ -104,4 +104,4 @@ void RandAddSeedPerfmon()
//printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize); //printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);
} }
#endif #endif
} }

View File

@@ -24,7 +24,7 @@ static const unsigned int MAX_SIZE = 0x02000000;
template<typename T1> template<typename T1>
inline uint256 Hash(const T1 pbegin, const T1 pend) inline uint256 SHA256Hash(const T1 pbegin, const T1 pend)
{ {
static unsigned char pblank[1]; static unsigned char pblank[1];
uint256 hash1; uint256 hash1;
@@ -35,7 +35,7 @@ inline uint256 Hash(const T1 pbegin, const T1 pend)
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline uint256 Hash(const T1 p1begin, const T1 p1end, inline uint256 SHA256Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end) const T2 p2begin, const T2 p2end)
{ {
static unsigned char pblank[1]; static unsigned char pblank[1];
@@ -51,7 +51,7 @@ inline uint256 Hash(const T1 p1begin, const T1 p1end,
} }
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline uint256 Hash(const T1 p1begin, const T1 p1end, inline uint256 SHA256Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end, const T2 p2begin, const T2 p2end,
const T3 p3begin, const T3 p3end) const T3 p3begin, const T3 p3end)
{ {
@@ -103,4 +103,4 @@ inline uint160 Hash160(const std::vector<unsigned char>& vch)
#endif #endif
*/ */
#endif #endif

View File

@@ -128,7 +128,7 @@ inline std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
{ {
// add 4-byte hash check to the end // add 4-byte hash check to the end
std::vector<unsigned char> vch(vchIn); std::vector<unsigned char> vch(vchIn);
uint256 hash = Hash(vch.begin(), vch.end()); uint256 hash = SHA256Hash(vch.begin(), vch.end());
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4); vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
return EncodeBase58(vch); return EncodeBase58(vch);
} }
@@ -142,7 +142,7 @@ inline bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRe
vchRet.clear(); vchRet.clear();
return false; return false;
} }
uint256 hash = Hash(vchRet.begin(), vchRet.end()-4); uint256 hash = SHA256Hash(vchRet.begin(), vchRet.end()-4);
if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) if (memcmp(&hash, &vchRet.end()[-4], 4) != 0)
{ {
vchRet.clear(); vchRet.clear();