You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's see an example.
Using bitify & sha256 circuits.
sha256 circuit expects bit array input. In the array the lower index, 0, corresponds to the higher bit, the higher index, lets say 7th corresponds to lower bit.
Example:
237 (decimal) = 0xed = 11101101 (binay)
the input signal file would be:
{ "number" = ["1","1","1","0","1","1","0","1"] }
visually correct, but the mapping signal would be:
number[0]=1;
number[1]=0;
number[2]=1;
number[3]=1;
number[4]=0;
number[5]=1;
number[6]=1;
number[7]=1;
That does not match the array order in the JSON format. Anyway SAH256 accepts that order to compute the proper hash.
On the other hand Num2bits operation in bitify libray would do the follwing transformation:
Numb2bits(237)
num2bits.out[0]=1;
num2bits.out[1]=1;
num2bits.out[2]=1;
num2bits.out[3]=0;
num2bits.out[4]=1;
num2bits.out[5]=1;
num2bits.out[6]=0;
num2bits.out[7]=1;
What looks correct as the array index corresponds with the bit weigth in the binary form.
Unfortunatelly SHA256 expects bit input order in the signal as the reading order and not in the logical order (like Num2bits works) so
sha256.in <== num2bits.out
does not work, and it requires a bit swap.
The text was updated successfully, but these errors were encountered:
Let's see an example.
Using bitify & sha256 circuits.
sha256 circuit expects bit array input. In the array the lower index, 0, corresponds to the higher bit, the higher index, lets say 7th corresponds to lower bit.
Example:
237 (decimal) = 0xed = 11101101 (binay)
the input signal file would be:
{ "number" = ["1","1","1","0","1","1","0","1"] }
visually correct, but the mapping signal would be:
number[0]=1;
number[1]=0;
number[2]=1;
number[3]=1;
number[4]=0;
number[5]=1;
number[6]=1;
number[7]=1;
That does not match the array order in the JSON format. Anyway SAH256 accepts that order to compute the proper hash.
On the other hand Num2bits operation in bitify libray would do the follwing transformation:
Numb2bits(237)
num2bits.out[0]=1;
num2bits.out[1]=1;
num2bits.out[2]=1;
num2bits.out[3]=0;
num2bits.out[4]=1;
num2bits.out[5]=1;
num2bits.out[6]=0;
num2bits.out[7]=1;
What looks correct as the array index corresponds with the bit weigth in the binary form.
Unfortunatelly SHA256 expects bit input order in the signal as the reading order and not in the logical order (like Num2bits works) so
does not work, and it requires a bit swap.
The text was updated successfully, but these errors were encountered: