1
Can anyone please explain the code below with comments?
What are pbegin & pend ?
What is ( I believe it is data, where it comes from ?): (pbegin == pend ? pblank : static_cast<const void*>(&pbegin[0]))
What is (I believe it is the size of data 80?) : (pend - pbegin) * sizeof(pbegin[0])
What is : pblank[1]
template<typename T1>
inline uint256 HashShabal(const T1 pbegin, const T1 pend)
{
sph_shabal256_context ctx_shabal;
static unsigned char pblank[1];
uint256 hash[1];
sph_shabal256_init(&ctx_shabal);
// ZSHABAL;
sph_shabal256 (&ctx_shabal, (pbegin == pend ? pblank : static_cast<const void*>(&pbegin[0])), (pend - pbegin) * sizeof(pbegin[0]));
sph_shabal256_close(&ctx_shabal, static_cast<void*>(&hash[0]));
return hash[0];
}
Out of curiosity, where'd you find this? – Nick ODell – 2015-08-29T05:15:16.033
@NickODell this can be found in most alt-coins that uses sphlib – Hanoosh – 2015-08-29T08:02:41.560