This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
185 lines (175 loc) · 8.43 KB
/
index.html
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<head>
<title>UltraCrypt</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/component.css">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
<div id="filepage">
<div class="centered-wrapper">
<h1>UltraCrypt</h1>
<input type="file" name="file-6[]" id="file-6" class="inputfile inputfile-5"
data-multiple-caption="{count} files selected" multiple />
<label for="file-6">
<figure><svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17">
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z" />
</svg></figure> <span></span>
</label>
<br>
<p><a href="#" onclick="return show('textpage', 'filepage')">or insert text</a></p>
<!-- Switch -->
<div class="Row">
<div class="Column jRight">Decrypt</div>
<div class="Column jCenter">
<label class="switch" style="justify-content: center">
<input type="checkbox" id="cryptYN">
<span class="slider round"></span>
</label>
</div>
<div class="Column jLeft">Encrypt</div>
</div>
<br>
<input id="password" type="password" placeholder="Password">
<br>
<p></p>
<button type="button" class="button" id="go">Go!</button>
<br><br>
<p>How to use this program:<br><br>
To Encrypt:<br>
Open a plaintext file<br>
Make sure the slider is on "Encrypt"<br>
Type in the encryption password (same as decryption password)<br>
Press "Go!"<br>
Save resulting encrypted file<br><br>
To Decrypt:<br>
Open encrypted file<br>
Make sure the slider is on "Decrypt"<br>
Type in the decryption password (same as the encryption password)<br>
Press "Go!"<br>
Save resulting plaintext file
</p>
<footer>
<p style="font-size: 9px">Check us out on <a
href="https://github.com/9p4/hackna">GitHub</a></p>
</footer>
</div>
<iframe id="download_iframe" style="display:none;"></iframe>
<script src="js/aes.js"></script>
<script>
var file = document.getElementById("file-6");
var passwd = document.getElementById("password");
var go = document.getElementById("go");
var cryptYN = document.getElementById("cryptYN");
var toDo = "";
var reader = new FileReader();
file.addEventListener('change', readFile, false);
function readFile(evt) {
reader.onload = function (event) {
toDo = event.target.result;
}
reader.readAsText(evt.target.files[0]);
}
go.onclick = function (evt) {
if (cryptYN.checked) {
var done = CryptoJS.AES.encrypt(toDo, passwd.value);
download("encrypted.uc", done)
} else {
var done = CryptoJS.AES.decrypt(toDo, passwd.value).toString(CryptoJS.enc.Utf8);
download("decrypted.txt", done);
}
}
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
</script>
<script src="js/custom-file-input.js"></script>
<script>(function (e, t, n) { var r = e.querySelectorAll("html")[0]; r.className = r.className.replace(/(^|\s)no-js(\s|$)/, "$1js$2") })(document, window, 0);</script>
</div>
<div id="textpage" style="display:none">
<div class="centered-wrapper">
<h1>UltraCrypt</h1>
<textarea id="text-input" cols="40" rows="5" placeholder="Insert or paste text here"></textarea>
<br>
<p><a href="#" onclick="return show('filepage', 'textpage')">or upload files</a></p>
<!-- Switch -->
<div class="Row">
<div class="Column jRight">Decrypt</div>
<div class="Column jCenter">
<label class="switch" style="justify-content: center">
<input type="checkbox" id="cryptYN">
<span class="slider round"></span>
</label>
</div>
<div class="Column jLeft">Encrypt</div>
</div>
<br>
<input id="password" type="password" placeholder="Password">
<br>
<p></p>
<button type="button" class="button" id="go">Go!</button>
<br><br>
<p>How to use this program:<br><br>
To Encrypt:<br>
Paste some plaintext into the textbox above.<br>
Make sure the slider is on "Encrypt"<br>
Type in the encryption password (same as decryption password)<br>
Press "Go!"<br>
Copy encrypted text in textbox to use<br><br>
To Decrypt:<br>
Paste encrypted text into textbox<br>
Make sure the slider is on "Decrypt"<br>
Type in the decryption password (same as the encryption password)<br>
Press "Go!"<br>
Copy plaintext in textbox to use
</p>
<footer>
<p style="font-size: 9px">Check us out on <a href="https://github.com/Stiffy2000/hackna">GitHub</a>
</p>
</footer>
</div>
<iframe id="download_iframe" style="display:none;"></iframe>
<script src="js/aes.js"></script>
<script>
var textB = document.getElementById("text-input");
var passwd = document.getElementById("password");
var go = document.getElementById("go");
var cryptYN = document.getElementById("cryptYN");
var toDo = "";
var done = "";
go.onclick = function (evt) {
toDo = textB.value;
if (cryptYN.checked) {
done = CryptoJS.AES.encrypt(toDo.toString(CryptoJS.enc.Utf8), passwd.value);
setTextBox(done);
} else {
done = CryptoJS.AES.decrypt(toDo, passwd.value).toString(CryptoJS.enc.Utf8);
setTextBox(done);
}
}
function setTextBox(stringz) {
textB.value = stringz;
}
</script>
<script src="js/custom-file-input.js"></script>
<script>(function (e, t, n) { var r = e.querySelectorAll("html")[0]; r.className = r.className.replace(/(^|\s)no-js(\s|$)/, "$1js$2") })(document, window, 0);</script>
</div>
<script>
// https://stackoverflow.com/questions/8211128/multiple-distinct-pages-in-one-html-file/8211324#8211324
function show(shown, hidden) {
document.getElementById(shown).style.display = 'block';
document.getElementById(hidden).style.display = 'none';
return false;
}
</script>
</body>