-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhasil.php
59 lines (56 loc) · 2.85 KB
/
hasil.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
error_reporting(0);
function ordutf8($string, &$offset) {
$code = ord(substr($string, $offset,1));
if ($code >= 128) { //otherwise 0xxxxxxx
if ($code < 224) $bytesnumber = 2; //110xxxxx
else if ($code < 240) $bytesnumber = 3; //1110xxxx
else if ($code < 248) $bytesnumber = 4; //11110xxx
$codetemp = $code - 192 - ($bytesnumber > 2 ? 32 : 0) - ($bytesnumber > 3 ? 16 : 0);
for ($i = 2; $i <= $bytesnumber; $i++) {
$offset ++;
$code2 = ord(substr($string, $offset, 1)) - 128; //10xxxxxx
$codetemp = $codetemp*64 + $code2;
}
$code = $codetemp;
}
$offset += 1;
if ($offset >= strlen($string)) $offset = -1;
return $code;
}
?>
<h5 class="teal-text text-accent-4">Kriptografi RSA</h5>
<table class="responsive-table">
<tbody>
<tr>
<td width="70px">Prima 1</td>
<td width="5px">:</td>
<td>
<?php
echo $_POST['prima-1'];
?>
</td>
</tr>
<tr>
<td>Prima 2</td>
<td>:</td>
<td>
<?php
echo $_POST['prima-2'];
?>
</td>
</tr>
<tr>
<td>ASCII</td>
<td>:</td>
<td>
<?php
$text = $_POST['plainteks'];
while ($offset >= 0) {
echo ordutf8($text, $offset)." ";
}
?>
</td>
</tr>
</tbody>
</table>