-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
45 lines (38 loc) · 1.08 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require "src/init.php";
use UDC\SymbolMapper;
use UDC\NoiseGenerator;
use UDC\UDC;
// Define mappings and noise symbols
// Initialize the encryption components
$symbolMapper = new SymbolMapper($mappings);
$noiseGenerator = new NoiseGenerator($noiseSymbols);
$encryptor = new UDC($symbolMapper, $noiseGenerator);
// Test text
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$text = $_POST["text"];
$action = $_POST["action"];
$encryptedText = $encryptor->encryptText($text);
echo "Encrypted Text: " . $encryptedText;
$decryptedText = $encryptor->decryptText($encryptedText);
echo "Decrypted Text: " . $decryptedText;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Encryptor</title>
</head>
<body>
<h1>Text Encryptor and Decryptor</h1>
<form method="POST">
<label for="text">Enter Text:</label>
<input type="text" id="text" name="text" required>
<br>
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>