MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetMinimalFromIndices

Function GetMinimalFromIndices

src/crypto/equihash.cpp:207–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207std::vector<unsigned char> GetMinimalFromIndices(std::vector<eh_index> indices,
208 size_t cBitLen)
209{
210 assert(((cBitLen+1)+7)/8 <= sizeof(eh_index));
211 size_t lenIndices { indices.size()*sizeof(eh_index) };
212 size_t minLen { (cBitLen+1)*lenIndices/(8*sizeof(eh_index)) };
213 size_t bytePad { sizeof(eh_index) - ((cBitLen+1)+7)/8 };
214 std::vector<unsigned char> array(lenIndices);
215 for (size_t i = 0; i < indices.size(); i++) {
216 EhIndexToArray(indices[i], array.data()+(i*sizeof(eh_index)));
217 }
218 std::vector<unsigned char> ret(minLen);
219 CompressArray(array.data(), lenIndices,
220 ret.data(), minLen, cBitLen+1, bytePad);
221 return ret;
222}
223
224template<size_t WIDTH>
225StepRow<WIDTH>::StepRow(const unsigned char* hashIn, size_t hInLen,

Callers 1

TestEquihashValidatorFunction · 0.85

Calls 4

EhIndexToArrayFunction · 0.85
CompressArrayFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TestEquihashValidatorFunction · 0.68