-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
34 lines (24 loc) · 828 Bytes
/
Copy pathmain.js
File metadata and controls
34 lines (24 loc) · 828 Bytes
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
function $(id) {
return document.getElementById(id);
}
function strip(str) {
return str.replace(/\s+/g, '');
}
window.onload = function() {
var cipherTextArea = $('ciphertext_area'),
crackButton = $('crack_button'),
crackList = $('crack_list'),
listTitle = $('list_title');
crackButton.onclick = function() {
var i, li, div;
listTitle.style.display = 'block';
cipherTextArea.value = strip(cipherTextArea.value).toUpperCase();
crackInfo = Vigenere.crack(cipherTextArea.value, 10);
for (i = 0; i < crackInfo.length; ++i) {
li = document.createElement('li');
li.innerHTML = crackInfo[i][1];
crackList.appendChild(li);
}
console.log(crackInfo.length);
};
};