//test pragma circom 2.1.9; include "anemoi/anemoi_2_to_1_Jubjub.circom"; include "anemoi/anemoi_4_to_1_Jubjub.circom"; include "anemoi/anemoi_16_to_1_Jubjub.circom"; include "../../circomlib-master/circuits/bitify.circom"; template BLSLessThan(n) { assert(n <= 253); signal input in[2]; signal output out; component n2b = Num2Bits(n+1); n2b.in <== in[0]+ (1< n2b.in; for (var i=0; i<255; i++) { n2b.out[i] ==> out[i]; if(i != 0){ n2b.out[i] ==> check_range.in[i-1]; } } check_range.out * (n2b.out[0]) === 0; //must be zero exept if the first bit is 0 => then in is on 254 bits and p-1 on 255 } template BLSBits2Num_strict() { signal input in[255]; signal output out; component check_range = CompConstant(23487852865797141623554994256013988874373056334117496812739262697960298774528); component b2n = Bits2Num(255); for (var i=0; i<255; i++) { in[i] ==> b2n.in[i]; if(i != 0){ in[i] ==> check_range.in[i-1]; } } check_range.out * in[0] === 0; b2n.out ==> out; } template check_bits(n){ signal input bits[n]; for(var i=0; i