From f7d1539df4271e4723f6e6e3f21b0429ab472d11 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 5 Dec 2011 13:21:52 -0800 Subject: [PATCH] Identify which hashes we're using. --- BitcoinUtil.cpp | 2 +- BitcoinUtil.h | 8 ++++---- base58.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BitcoinUtil.cpp b/BitcoinUtil.cpp index 1315b85033..87707f476d 100644 --- a/BitcoinUtil.cpp +++ b/BitcoinUtil.cpp @@ -104,4 +104,4 @@ void RandAddSeedPerfmon() //printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize); } #endif -} \ No newline at end of file +} diff --git a/BitcoinUtil.h b/BitcoinUtil.h index 5f01ead5a0..e9b5fb21a3 100644 --- a/BitcoinUtil.h +++ b/BitcoinUtil.h @@ -24,7 +24,7 @@ static const unsigned int MAX_SIZE = 0x02000000; template -inline uint256 Hash(const T1 pbegin, const T1 pend) +inline uint256 SHA256Hash(const T1 pbegin, const T1 pend) { static unsigned char pblank[1]; uint256 hash1; @@ -35,7 +35,7 @@ inline uint256 Hash(const T1 pbegin, const T1 pend) } template -inline uint256 Hash(const T1 p1begin, const T1 p1end, +inline uint256 SHA256Hash(const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end) { static unsigned char pblank[1]; @@ -51,7 +51,7 @@ inline uint256 Hash(const T1 p1begin, const T1 p1end, } template -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 T3 p3begin, const T3 p3end) { @@ -103,4 +103,4 @@ inline uint160 Hash160(const std::vector& vch) #endif */ -#endif \ No newline at end of file +#endif diff --git a/base58.h b/base58.h index 5dfbba1065..9115e3380c 100644 --- a/base58.h +++ b/base58.h @@ -128,7 +128,7 @@ inline std::string EncodeBase58Check(const std::vector& vchIn) { // add 4-byte hash check to the end std::vector 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); return EncodeBase58(vch); } @@ -142,7 +142,7 @@ inline bool DecodeBase58Check(const char* psz, std::vector& vchRe vchRet.clear(); 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) { vchRet.clear();