mirror of
https://github.com/tornadocash/snarkjs.git
synced 2024-06-29 01:07:48 +02:00
40 lines
684 B
JavaScript
40 lines
684 B
JavaScript
|
|
||
|
|
||
|
class ZnField {
|
||
|
constructor(n) {
|
||
|
this.n = n;
|
||
|
}
|
||
|
|
||
|
add(a, b) {
|
||
|
const maxGrade = Math.max(a.length, b.length);
|
||
|
const res = new Array(maxGrade);
|
||
|
for (let i=0; i<maxGrade; i++) {
|
||
|
res[i] = this.F.add(a[i], b[i]);
|
||
|
}
|
||
|
return this._reduce(res);
|
||
|
}
|
||
|
|
||
|
sub(a, b) {
|
||
|
// TODO
|
||
|
throw new Error("Not Implementted");
|
||
|
}
|
||
|
|
||
|
mul(a, b) {
|
||
|
// TODO
|
||
|
throw new Error("Not Implementted");
|
||
|
}
|
||
|
|
||
|
inverse(a, b) {
|
||
|
// TODO
|
||
|
throw new Error("Not Implementted");
|
||
|
}
|
||
|
|
||
|
div(a, b) {
|
||
|
// TODO
|
||
|
throw new Error("Not Implementted");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
module.exports = ZnField;
|