iden3 / circomlib

Library of basic circuits for circom
587 stars 208 forks source link

What is the \ operator and why is it used instead of / ? #41

Open bitcartel opened 4 years ago

bitcartel commented 4 years ago

pedersen_old.circom 26: var nexps = ((n-1) \ 250) + 1;

escalarmulfix.circom 238: var nsegments = (n-1)\246 +1; // 249 probably would work. But I'm not sure and for security I keep 246 254: nWindows = ((nseg - 1)\3)+1;

gates.circom 81: var n1 = n\2; 82: var n2 = n-n\2;

pedersen.circom 192: var nSegments = ((n-1)\200)+1; 202: nWindows = ((nBits - 1)\4)+1;

escalarmulany.circom 135: var nsegments = (n-1)\148 +1;

sha256/sha256.circom 16: nBlocks = ((nBits + 64)\512)+1;

lispc commented 3 years ago

"/" is divide in the finite field. For example, for a 7-mod field, 2*5 == 3, 3/2 == 5, "\" is normal divide for human. For example, 3\2 == 1.