Skip to content

Instantly share code, notes, and snippets.

@vio1etus
Last active June 5, 2023 04:45
Show Gist options
  • Save vio1etus/bda8e464326c4c0f865d3c85c6579bfc to your computer and use it in GitHub Desktop.
Save vio1etus/bda8e464326c4c0f865d3c85c6579bfc to your computer and use it in GitHub Desktop.

Open this in zkREPL →

This file can be included into other zkREPLs with include "gist:bda8e464326c4c0f865d3c85c6579bfc";

pragma circom 2.1.2;
include "circomlib/compconstant.circom";
template IsNegative () {
signal input in[254];
signal output out;
//https://www.cs.utexas.edu/users/moore/acl2/manuals/current/manual/index-seo.php/ZKSEMAPHORE____BABY-JUBJUB-PRIME
// the Babyjubjub prime p=21888242871839275222246405745257275088548364400416034343698204186575808495617
component comp = CompConstant(10944121435919637611123202872628637544274182200208017171849102093287904247808);
for(var i = 0; i < 254; i++){
comp.in[i] <== in[i];
}
out <== comp.out;
}
component main = IsNegative();
/* INPUT = {
"in": ["5"] // 254 bits neededs.
} */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment