Closed fleupold closed 5 years ago
Looked into the PR. Looks good.
Currently tests are not passing, because: unsigned long nr = number.as_ulong(); can not represent the full precision. We should work with mpz...
unsigned long nr = number.as_ulong(); is used here
void decomposeBits(field254 number, field254* bits, uint32_t offset) {
int index = 0;
unsigned long nr = number.as_ulong();
while (nr > 0) {
if(nr%2==0)
bits[offset + 253 - index] = field254::zero();
else
bits[offset + 253 - index] = field254::one();
nr = nr/2;
index++;
}
}
We have been using dummy implementations for our hash functions inside the unit tests. While this was fine for unit tests, it is a problem if we want to share the same code to convert the solver's output (json) into public/private input for pepper (which requires passing the correct hashes).
This change makes it so that we use real implementations for the hash function in the test. We could consider making the concrete implementation "depend" on a macro (different for test/input conversion) if we feel that compiling the gadgets for the unit tests becomes too time consuming.