arnaucube
arnaucube/circomPublic Self-hosted repository
circom/jose.js
jose.jsRaw
  1const bigInt = require("big-integer");
  2const __P__ = new bigInt("21888242871839275222246405745257275088696311157297823662689037894645226208583");
  3const __MASK__ = new bigInt(2).pow(253).minus(1);
  4const circuit = {};
  5module.exports = circuit;
  6
  7circuit.signals={
  8 "one": {
  9  "fullName": "one",
 10  "value": "1",
 11  "equivalence": "",
 12  "direction": "",
 13  "id": 0
 14 },
 15 "main.s1": {
 16  "fullName": "main.s1",
 17  "direction": "IN",
 18  "component": "main",
 19  "equivalence": "",
 20  "alias": [
 21   "main.s1"
 22  ],
 23  "id": 1
 24 },
 25 "main.s2": {
 26  "fullName": "main.s2",
 27  "direction": "IN",
 28  "component": "main",
 29  "equivalence": "",
 30  "alias": [
 31   "main.s2"
 32  ],
 33  "id": 2
 34 },
 35 "main.s3": {
 36  "fullName": "main.s3",
 37  "direction": "OUT",
 38  "component": "main",
 39  "equivalence": "",
 40  "alias": [
 41   "main.s3"
 42  ],
 43  "id": 3
 44 }
 45};
 46
 47circuit.components={
 48 "main": {
 49  "signals": [
 50   "main.s1",
 51   "main.s2",
 52   "main.s3"
 53  ],
 54  "params": {},
 55  "template": "AND",
 56  "inputSignals": 2
 57 }
 58};
 59
 60circuit.signalConstrains=[
 61 {
 62  "type": "QEQ",
 63  "a": {
 64   "type": "LINEARCOMBINATION",
 65   "values": {
 66    "main.s1": "21888242871839275222246405745257275088696311157297823662689037894645226208582"
 67   }
 68  },
 69  "b": {
 70   "type": "LINEARCOMBINATION",
 71   "values": {
 72    "main.s2": "1"
 73   }
 74  },
 75  "c": {
 76   "type": "LINEARCOMBINATION",
 77   "values": {
 78    "main.s3": "1"
 79   }
 80  }
 81 },
 82 {
 83  "type": "QEQ",
 84  "a": {
 85   "type": "LINEARCOMBINATION",
 86   "values": {
 87    "main.s1": "1"
 88   }
 89  },
 90  "b": {
 91   "type": "LINEARCOMBINATION",
 92   "values": {
 93    "main.s1": "1",
 94    "one": "21888242871839275222246405745257275088696311157297823662689037894645226208582"
 95   }
 96  },
 97  "c": {
 98   "type": "LINEARCOMBINATION",
 99   "values": {}
100  }
101 },
102 {
103  "type": "QEQ",
104  "a": {
105   "type": "LINEARCOMBINATION",
106   "values": {
107    "main.s2": "1"
108   }
109  },
110  "b": {
111   "type": "LINEARCOMBINATION",
112   "values": {
113    "main.s2": "1",
114    "one": "21888242871839275222246405745257275088696311157297823662689037894645226208582"
115   }
116  },
117  "c": {
118   "type": "LINEARCOMBINATION",
119   "values": {}
120  }
121 }
122];
123
124circuit.witnessNames=[
125 [
126  "one"
127 ],
128 [
129  "main.s1"
130 ],
131 [
132  "main.s2"
133 ],
134 [
135  "main.s3"
136 ]
137];
138
139{
140}
141
142circuit.templates = {};
143
144circuit.templates["AND"] = function(ctx) {
145    ctx.setSignal("s3", [], bigInt(ctx.getSignal("s1", [])).times(ctx.getSignal("s2", [])).mod(__P__));
146    ctx.assert(ctx.getSignal("s3", []), bigInt(ctx.getSignal("s1", [])).times(ctx.getSignal("s2", [])).mod(__P__));
147    ctx.assert(bigInt(ctx.getSignal("s1", [])).times(bigInt(ctx.getSignal("s1", [])).add(__P__).minus("1").mod(__P__)).mod(__P__), "0");
148    ctx.assert(bigInt(ctx.getSignal("s2", [])).times(bigInt(ctx.getSignal("s2", [])).add(__P__).minus("1").mod(__P__)).mod(__P__), "0");
149}
150;
151circuit.functionParams={};
152
153
154circuit.functions = {};