How to convert negative numbers into bit string?

33 views Asked by At

If you want to bitlfy an integer in circom, you have to you use the Num2bits() from the circomlib library (an equivalent of libstdc++ for circom) such as :

inp = Num2bits(120);
inp.in = (3);

hash = Poseidon2(1);
has.in[0] = inp.out;

But what if I want to hash 1-2252 or -5 ? Even if the last bits are still 0 for the first case, unless I’m wrong, Num2bits() can’t be used in those case…

0

There are 0 answers