...
This commit is contained in:
@ -15,8 +15,14 @@ class Cyphertext {
|
||||
// Compute g^m by binomial theorem.
|
||||
let gm = (1n + key.n * plainText) % key.n ** 2n;
|
||||
|
||||
// Compute g^m r^n from crt
|
||||
// Compute g^m r^n from crt.
|
||||
this.cyphertext = (gm * mod_exp(r, key.n, key.n ** 2n)) % key.n ** 2n;
|
||||
|
||||
// Force into range.
|
||||
while (this.cyphertext < 0n) {
|
||||
this.cyphertext += key.n ** 2n;
|
||||
}
|
||||
|
||||
this.r = r;
|
||||
this.pubKey = key;
|
||||
this.plainText = plainText;
|
||||
|
@ -22,6 +22,7 @@ window.addEventListener("beforeunload", () => {
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
socket = io();
|
||||
|
||||
random = new Random();
|
||||
barrier = new Barrier();
|
||||
|
||||
@ -33,6 +34,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
});
|
||||
|
||||
socket.on("message", async (packet) => {
|
||||
window.console.log(`Received size: ${JSON.stringify(packet).length}`);
|
||||
|
||||
let data = packet.payload;
|
||||
if (data.type !== "KEEPALIVE") window.console.log(data);
|
||||
|
||||
|
Reference in New Issue
Block a user