non so leggere
All checks were successful
Deploy / trigger (push) Successful in 21s

This commit is contained in:
2026-03-31 12:36:02 +02:00
parent 3e5d359282
commit 59f4cd0777
2 changed files with 7 additions and 7 deletions

View File

@@ -14,15 +14,15 @@ public class Seal {
System.out.println("Generazione chiavi RSA per il server web in corso..."); System.out.println("Generazione chiavi RSA per il server web in corso...");
// Cifratura con Cifrario di Cesare // Cifratura con Cifrario di Vigenere
app.post("/seal/caesar/encrypt", ctx -> { app.post("/seal/vigenere/encrypt", ctx -> {
} }
); );
// Decifratura con Cifrario di Vigenere // Cifratura con Cifrario di Cesare
app.post("/seal/vigenere/encrypt", ctx -> { app.post("/seal/caesar/encrypt", ctx -> {
RichiestaCesare req = ctx.bodyAsClass(RichiestaCesare.class); RichiestaCesare req = ctx.bodyAsClass(RichiestaCesare.class);
String ciphertext = Caesar.encode(req.plaintext,req.key); String ciphertext = Caesar.encode(req.plaintext,req.key);
ctx.result(ciphertext); ctx.result(ciphertext);

View File

@@ -5,13 +5,13 @@ async function encrypt() {
if (!plaintext) return alert("Inserisci del testo!"); if (!plaintext) return alert("Inserisci del testo!");
try { try {
const risposta = await fetch("/seal/cesare/encrypt", { const risposta = await fetch("/seal/caesar/encrypt", {
method: "POST", headers: { "Content-Type": "application/json" }, method: "POST", headers: { "Content-Type": "application/json" },
// Invia il testo e la chiave (convertita in numero) al server // Invia il testo e la chiave (convertita in numero) al server
body: JSON.stringify({ plaintext: plaintext, key: parseInt(key) }) body: JSON.stringify({ plaintext: plaintext, key: parseInt(key) })
}); });
document.getElementById("ciphertext").value = await risposta.text(); document.getElementById("ciphertext").value = await risposta.text();
} catch (e) { alert("Errore di connessione con le API di Cesare!"); } } catch (e) { alert("Errore di connessione con le API di caesar!"); }
} }
async function decrypt() { async function decrypt() {
@@ -20,7 +20,7 @@ async function decrypt() {
if (!ciphertext) return alert("Nessun testo da decifrare!"); if (!ciphertext) return alert("Nessun testo da decifrare!");
try { try {
const res = await fetch("/seal/cesare/decrypt", { const res = await fetch("/seal/caesar/decrypt", {
method: "POST", headers: { "Content-Type": "application/json" }, method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ testo: ciphertext, chiave: parseInt(key) }) body: JSON.stringify({ testo: ciphertext, chiave: parseInt(key) })
}); });