-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
156 lines (146 loc) · 5.52 KB
/
index.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cipher Website</title>
<link rel="stylesheet" href="style.css">
<script src="jQuery/jquery-3.6.0.min.js"></script>
</head>
<body>
<h1 class="title">CIPHER WEBSITE</h1>
<?php include("header.php"); ?>
<div class="container" id="container">
<p>In cryptography, a cipher (or cypher) is an algorithm for performing encryption or decryption—a series of well-defined steps that can be followed as a procedure. An alternative, less common term is encipherment. To encipher or encode is to convert information into cipher or code. In common parlance, " cipher" is synonymous with "code" , as they are both a set of steps that encrypt a message; however, the concepts are distinct in cryptography, especially classical cryptography.</p>
<p>Codes generally substitute different length strings of character in the output, while ciphers generally substitute the same number of characters as are input. There are exceptions and some cipher systems may use slightly more, or fewer, characters when output versus the number that were input.</p>
<p>Codes operated by substituting according to a large codebook which linked a random string of characters or numbers to a word or phrase. For example, "UQJHSE" could be the code for "Proceed to the following coordinates." When using a cipher the original information is known as plaintext, and the encrypted form as ciphertext. The ciphertext message contains all the information of the plaintext message, but is not in a format readable by a human or computer without the proper mechanism to decrypt it.</p>
<p>The operation of a cipher usually depends on a piece of auxiliary information, called a key (or, in traditional NSA parlance, a cryptovariable). The encrypting procedure is varied depending on the key, which changes the detailed operation of the algorithm. A key must be selected before using a cipher to encrypt a message. Without knowledge of the key, it should be extremely difficult, if not impossible, to decrypt the resulting ciphertext into readable plaintext.</p>
</div>
</body>
<script>
function onNavClick(linkTitle) {
var x = document.getElementsByClassName('current');
x[0].className = x[0].className.replace(' current', '');
var y = document.getElementById(linkTitle);
y.className += " current";
console.log(linkTitle);
if (linkTitle === 'c') {
$('#container').load('ceaser.php');
} else if (linkTitle === 'v') {
$('.container').load('vigenere.php');
} else if (linkTitle === 'h') {
$('.container').load('hill.php');
} else if (linkTitle === 'p') {
$('.container').load('playfair.php');
} else if (linkTitle === 'combined') {
$('.container').load('combined.php');
}
}
function encryptCeaser() {
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_cc.php', {
key: data.key,
plain_text: data.plain_text
}
).done((result) => {
document.getElementsByName('cipher_text')[0].innerText = result;
})
}
function decryptCeaser() {
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_cc.php', {
key: data.key,
cipher_text: data.cipher_text
}
).done((result) => {
document.getElementsByName('plain_text')[0].innerText = result;
})
}
function encryptV() {
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_vc.php', {
key: data.key,
plain_text: data.plain_text
}
).done((result) => {
document.getElementsByName('cipher_text')[0].innerText = result;
})
}
function decryptV() {
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_vc.php', {
key: data.key,
cipher_text: data.cipher_text
}
).done((result) => {
document.getElementsByName('plain_text')[0].innerText = result;
})
}
function encryptP() {
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_pf.php', {
key: data.key,
plain_text: data.plain_text
}
).done((result) => {
document.getElementsByName('cipher_text')[0].innerText = result;
})
}
function decryptP() {
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_pf.php', {
key: data.key,
cipher_text: data.cipher_text
}
).done((result) => {
document.getElementsByName('plain_text')[0].innerText = result;
})
}
function encryptComb() {
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_comb.php', {
key1: data.key1,
key2: data.key2,
key3: data.key3,
plain_text: data.plain_text
}
).done((result) => {
document.getElementsByName('cipher_text')[0].innerText = result;
})
}
function encryptH(){
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries());
console.log(data);
$.post(
'r_hc.php', {
key: data.key,
plain_text: data.plain_text
}
).done((result) => {
document.getElementsByName('cipher_text')[0].innerText = result;
})
}
</script>
</html>