-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrot13.php
More file actions
63 lines (62 loc) · 1.88 KB
/
rot13.php
File metadata and controls
63 lines (62 loc) · 1.88 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
##
## This code is licensed under the GPL-v3
## Belongs to the "encrypt" system that can be found here:
## https://github.com/CaeSpock/encrypt
## Questions and suggestions are always welcomed. Send me an E-Mail at: CAnibarro<at>WhiteSith<dot>com
##
// Cesar cipher Type 1 - K=13
// ROT-13 aka ROT13
echo "<div class=\"table-responsive\">\n";
echo "<table class=\"table table-sm\">\n";
echo "<tr>\n";
echo " <td class=\"table-dark text-right\">$l_type:</td>\n";
echo " <td>$l_rot13</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class=\"table-dark text-right\">$l_alphabet:</td>\n";
echo " <td><pre>";
for ($i=65; $i<=90; $i++) {
echo chr($i);
}
echo "</pre></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class=\"table-dark text-right\">$l_newalphabet:</td>\n";
echo " <td><pre>";
for ($i=65; $i<=90; $i++) {
$position=$i;
if ($i>65+12) { $position=$i-26; }
$letter=$position+13;
echo chr($letter);
}
echo "</pre></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class=\"bg-warning text-right\"><strong>$l_phrase:</strong></td>\n";
echo " <td><pre>$phrase</pre></td>";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class=\"bg-success text-right\"><strong>$l_newphrase:</strong></td>\n";
echo " <td><pre>";
$counter=0;
while ($counter < strlen($phrase)) {
$position = ord($phrase[$counter]);
if ($position >=65 and $position<=90) {
if ($position > 65+12) {
$position=$position-13;
} else {
$position=$position+13;
}
}
echo chr($position);
$counter++;
}
echo "</pre></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "<br /><br />";
echo "<div class=\"text text-center\">\n";
echo "<a href=\"$phpself\" class=\"btn btn-secondary\" role=\"button\">$l_goback</a>\n";
echo "</div>";