started working on another proof

This commit is contained in:
jude
2023-04-25 18:05:44 +01:00
parent 810382fc4f
commit 7591c84823
2 changed files with 61 additions and 0 deletions

View File

@ -97,6 +97,20 @@ class Ciphertext {
}
}
mul(e) {
this.cipherText = mod_exp(this.cipherText, e, this.pubKey.n2);
this.r = mod_exp(this.r, e, this.pubKey.n2);
this.plainText = (this.plainText * e) % this.pubKey.n2;
// Force into range
while (this.cipherText < 0n) {
this.cipherText += this.pubKey.n2;
}
while (this.plainText < 0n) {
this.plainText += this.pubKey.n2;
}
}
toString() {
return "0x" + this.cipherText.toString(16);
}
@ -202,6 +216,15 @@ export class ReadOnlyCiphertext {
}
}
mul(e) {
this.cipherText = mod_exp(this.cipherText, e, this.pubKey.n2);
// Force into range
while (this.cipherText < 0n) {
this.cipherText += this.pubKey.n2;
}
}
prove(plainText, a) {
return new ValueProofSessionVerifier(this, plainText, a);
}