arnaucube
arnaucube/circomPublic Self-hosted repository
circom/src/zqfield.js
src/zqfield.jsRaw
 1const bigInt = require("big-integer");
 2
 3module.exports = class ZqField {
 4    constructor(p) {
 5        this.p = p;
 6    }
 7
 8    add(a, b) {
 9        return a.add(b).mod(this.p);
10    }
11
12    mul(a, b) {
13        return a.mul(b).mod(this.p);
14    }
15
16    lt(a, b) {
17        return a.lt(b) ? bigInt(1) : bigInt(0);
18    }
19
20    eq(a, b) {
21        return a.eq(b) ? bigInt(1) : bigInt(0);
22    }
23
24    gt(a, b) {
25        return a.gt(b) ? bigInt(1) : bigInt(0);
26    }
27
28    leq(a, b) {
29        return a.leq(b) ? bigInt(1) : bigInt(0);
30    }
31
32    geq(a, b) {
33        return a.geq(b) ? bigInt(1) : bigInt(0);
34    }
35
36    neq(a, b) {
37        return a.neq(b) ? bigInt(1) : bigInt(0);
38    }
39
40};
41