mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
refactor: remove unused Hash function variants
The three object variant was removed in dash#3276 through the backport of bitcoin#11385, leaving behind the four, five and six variant options. They aren't used anywhere in the codebase and aren't present in Bitcoin Core currently, and so, have been removed.
This commit is contained in:
parent
35f1c94672
commit
7ddf2ff59b
54
src/hash.h
54
src/hash.h
@ -106,60 +106,6 @@ inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compute the 256-bit hash of the concatenation of three objects. */
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4>
|
|
||||||
inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
|
||||||
const T2 p2begin, const T2 p2end,
|
|
||||||
const T3 p3begin, const T3 p3end,
|
|
||||||
const T4 p4begin, const T4 p4end) {
|
|
||||||
static const unsigned char pblank[1] = {};
|
|
||||||
uint256 result;
|
|
||||||
CHash256().Write(p1begin == p1end ? pblank : (const unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0]))
|
|
||||||
.Write(p2begin == p2end ? pblank : (const unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0]))
|
|
||||||
.Write(p3begin == p3end ? pblank : (const unsigned char*)&p3begin[0], (p3end - p3begin) * sizeof(p3begin[0]))
|
|
||||||
.Write(p4begin == p4end ? pblank : (const unsigned char*)&p4begin[0], (p4end - p4begin) * sizeof(p4begin[0]))
|
|
||||||
.Finalize((unsigned char*)&result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Compute the 256-bit hash of the concatenation of three objects. */
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4, typename T5>
|
|
||||||
inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
|
||||||
const T2 p2begin, const T2 p2end,
|
|
||||||
const T3 p3begin, const T3 p3end,
|
|
||||||
const T4 p4begin, const T4 p4end,
|
|
||||||
const T5 p5begin, const T5 p5end) {
|
|
||||||
static const unsigned char pblank[1] = {};
|
|
||||||
uint256 result;
|
|
||||||
CHash256().Write(p1begin == p1end ? pblank : (const unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0]))
|
|
||||||
.Write(p2begin == p2end ? pblank : (const unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0]))
|
|
||||||
.Write(p3begin == p3end ? pblank : (const unsigned char*)&p3begin[0], (p3end - p3begin) * sizeof(p3begin[0]))
|
|
||||||
.Write(p4begin == p4end ? pblank : (const unsigned char*)&p4begin[0], (p4end - p4begin) * sizeof(p4begin[0]))
|
|
||||||
.Write(p5begin == p5end ? pblank : (const unsigned char*)&p5begin[0], (p5end - p5begin) * sizeof(p5begin[0]))
|
|
||||||
.Finalize((unsigned char*)&result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Compute the 256-bit hash of the concatenation of three objects. */
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
|
||||||
inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
|
||||||
const T2 p2begin, const T2 p2end,
|
|
||||||
const T3 p3begin, const T3 p3end,
|
|
||||||
const T4 p4begin, const T4 p4end,
|
|
||||||
const T5 p5begin, const T5 p5end,
|
|
||||||
const T6 p6begin, const T6 p6end) {
|
|
||||||
static const unsigned char pblank[1] = {};
|
|
||||||
uint256 result;
|
|
||||||
CHash256().Write(p1begin == p1end ? pblank : (const unsigned char*)&p1begin[0], (p1end - p1begin) * sizeof(p1begin[0]))
|
|
||||||
.Write(p2begin == p2end ? pblank : (const unsigned char*)&p2begin[0], (p2end - p2begin) * sizeof(p2begin[0]))
|
|
||||||
.Write(p3begin == p3end ? pblank : (const unsigned char*)&p3begin[0], (p3end - p3begin) * sizeof(p3begin[0]))
|
|
||||||
.Write(p4begin == p4end ? pblank : (const unsigned char*)&p4begin[0], (p4end - p4begin) * sizeof(p4begin[0]))
|
|
||||||
.Write(p5begin == p5end ? pblank : (const unsigned char*)&p5begin[0], (p5end - p5begin) * sizeof(p5begin[0]))
|
|
||||||
.Write(p6begin == p6end ? pblank : (const unsigned char*)&p6begin[0], (p6end - p6begin) * sizeof(p6begin[0]))
|
|
||||||
.Finalize((unsigned char*)&result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Compute the 160-bit hash an object. */
|
/** Compute the 160-bit hash an object. */
|
||||||
template<typename T1>
|
template<typename T1>
|
||||||
inline uint160 Hash160(const T1 pbegin, const T1 pend)
|
inline uint160 Hash160(const T1 pbegin, const T1 pend)
|
||||||
|
Loading…
Reference in New Issue
Block a user