You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
604 B

  1. pragma circom 2.0.0;
  2. include "../../circuits/bitify.circom";
  3. include "../../circuits/binsub.circom";
  4. template A() {
  5. signal input a; //private
  6. signal input b;
  7. signal output out;
  8. var i;
  9. component n2ba = Num2Bits(16);
  10. component n2bb = Num2Bits(16);
  11. component sub = BinSub(16);
  12. component b2n = Bits2Num(16);
  13. n2ba.in <== a;
  14. n2bb.in <== b;
  15. for (i=0; i<16; i++) {
  16. sub.in[0][i] <== n2ba.out[i];
  17. sub.in[1][i] <== n2bb.out[i];
  18. }
  19. for (i=0; i<16; i++) {
  20. b2n.in[i] <== sub.out[i];
  21. }
  22. out <== b2n.out;
  23. }
  24. component main = A();