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

Function GetIndicesFromMinimal

src/crypto/equihash.cpp:191–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191std::vector<eh_index> GetIndicesFromMinimal(std::vector<unsigned char> minimal,
192 size_t cBitLen)
193{
194 assert(((cBitLen+1)+7)/8 <= sizeof(eh_index));
195 size_t lenIndices { 8*sizeof(eh_index)*minimal.size()/(cBitLen+1) };
196 size_t bytePad { sizeof(eh_index) - ((cBitLen+1)+7)/8 };
197 std::vector<unsigned char> array(lenIndices);
198 ExpandArray(minimal.data(), minimal.size(),
199 array.data(), lenIndices, cBitLen+1, bytePad);
200 std::vector<eh_index> ret;
201 for (size_t i = 0; i < lenIndices; i += sizeof(eh_index)) {
202 ret.push_back(ArrayToEhIndex(array.data()+i));
203 }
204 return ret;
205}
206
207std::vector<unsigned char> GetMinimalFromIndices(std::vector<eh_index> indices,
208 size_t cBitLen)

Callers 2

IsValidSolutionMethod · 0.85
TestEquihashSolversFunction · 0.85

Calls 5

ExpandArrayFunction · 0.85
ArrayToEhIndexFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45
push_backMethod · 0.45

Tested by 1

TestEquihashSolversFunction · 0.68