Closed barryWhiteHat closed 6 years ago
After investigating this a ilttle more i found that alt_bn128 allows for 253 bit input variables(FieldT.capacity()
). So when I pass 256 bits. It splits them into 2 variables the first 253 bits and the second 3 bits. Thats why I am missing 3 bits at the start.
here I insert a merkle root into a pb_variable.
I then use a that multipacking_gadget is equal to an input. So I don't have to deal with binary outputs when i do some validation in an ethereum contract.
When i get the output I have one char stripped
0x7073d0f6560b22ab0b35795244edc340316d5927dcde8aaef87b3b6cbd3b066
when i should have0xe7073d0f6560b22ab0b35795244edc340316d5927dcde8aaef87b3b6cbd3b066
Reproduction
git clone https://github.com/barryWhiteHat/miximus
git submodule update --init --recursive
mkdir build
cd build
cmake .. && make
cd ../zksnark_element && ../build/src/main
You will see inproof.json
the output0x7073d0f6560b22ab0b35795244edc340316d5927dcde8aaef87b3b6cbd3b066
If you analyze the output you will see
The merkle root
660dcbd3 ... f0bce0e7
is the exact same as0x7073d...b066
with opposite endianness and the missing final character.