div operators

This commit is contained in:
Jordi Baylina
2019-12-07 21:47:00 +01:00
parent 2a45647274
commit eaf4396cb3
9 changed files with 224 additions and 63 deletions

View File

@@ -9,6 +9,10 @@ module.exports = class ZqField {
return a.add(b).mod(this.p);
}
sub(a, b) {
return a.minus(b).mod(this.p);
}
mul(a, b) {
return a.mul(b).mod(this.p);
}
@@ -37,5 +41,17 @@ module.exports = class ZqField {
return a.neq(b) ? bigInt(1) : bigInt(0);
}
div(a, b) {
return a.mul(b.modInv(this.p)).mod(this.p);
}
idiv(a, b) {
return a.divide(b);
}
mod(a, b) {
return a.mod(b);
}
};