From 19c2ba6e1fb7bde71f3a22d76ceabee08959b24c Mon Sep 17 00:00:00 2001 From: Schuledaniel Date: Wed, 14 Jan 2026 14:01:43 +0100 Subject: [PATCH] task of LBT3 --- .../Kryptologie/caeser-verschluesselung.php | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Zweites Jahr/Kryptologie/caeser-verschluesselung.php diff --git a/Zweites Jahr/Kryptologie/caeser-verschluesselung.php b/Zweites Jahr/Kryptologie/caeser-verschluesselung.php new file mode 100644 index 0000000..dbea8e7 --- /dev/null +++ b/Zweites Jahr/Kryptologie/caeser-verschluesselung.php @@ -0,0 +1,111 @@ + count($textArr); $i++){ + // jeder buchstabe des textes wird zum array, + // in dessen ascii zeichen, $resAscii hinzugefügt + array_push($textAscii, ord($textArr[$i])); + // verschiebung + $resAscii[$i] =+ $shift; + // ascii buchstaben werden in ein wort gemacht + array_push($resArr, chr($resAscii[$i])); + } + // aus array ein wort machen + $result = implode("", $resArr); + + $yo = print_r($textArr); + echo "
 $yo 
"; + $yo = print_r($textAscii); + echo "
 $yo 
"; + $yo = print_r($resAscii); + echo "
 $yo 
"; + $yo = print_r($resArr); + echo "
 $yo 
"; + + return $result; +} + +// Formularverarbeitung +$output = ""; +$text = ""; +$shift = 0; +if ($_SERVER["REQUEST_METHOD"] === "POST") { + $text = $_POST["text"] ?? ""; + $shift = intval($_POST["shift"] ?? 0); + + if (isset($_POST["encrypt"])) { + $output = caesar($text, $shift); + } + + if (isset($_POST["decrypt"])) { + $output = caesar($text, -$shift); + } +} +?> + + + + + + Caesar Chiffre + + + + +
+

Caesar Chiffre

+ +
+ + + + + + + + + + + + +
+
+ + +