Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en" oncontextmenu="return false">
- <head>
- <title>Sample</title>
- </head>
- <body oncontextmenu="return false">
- <input type="text" id="text_input_1" name="myInput" size="30" required><br>
- <button type="button" id="button_1" name="myButton">Encrypt Text</button> <br>
- <strong id="text_output_1">This text is bold</strong><br>
- <button type="button" id="button_2" name="myButton">Decrypt Text</button><br>
- <strong id="text_output_2">This text is bold</strong><br>
- <script>
- let data = {33:{1:"374Bf1@B", 2:"YDv$Cx", 3:"S38aZp", 4:"8OZQP5", 5:"D9B!!Fe"}
- ,35:{1:"wwrNBiP5EB", 2:"YJBK!K!@", 3:"3YAl#ciep", 4:"qjD!BjXekD", 5:"XQSZ7s"}
- ,36:{1:"W?Xx07RkDM", 2:"Thlckka?&", 3:"X4tM#UWuXR", 4:"R??Jvz!l$", 5:"y5ixnUb"}
- ,37:{1:"EDsi&SNRF", 2:"Ma11Dgh", 3:"rq&Gf$C", 4:"!EutYFXX&b", 5:"I02A1Q"}
- ,38:{1:"8gCHR?CN&", 2:"va@aE#", 3:"Js!9!OO", 4:"A&$li?7L", 5:"ytnwJacqB"}
- ,48:{1:"$&2iee", 2:"eZ?KYf", 3:"&Pq3rJo", 4:"TfFR6oIb", 5:"Xbpcu6F6t"}
- ,49:{1:"%RqUfj", 2:"dZIvPuVnJ", 3:"laN2cuM&", 4:"Myg3z0wJcP", 5:"#Vq8T9%Zn!"}
- ,50:{1:"RUwOm%7R", 2:"G4t&ib", 3:"!UemLUEVdR", 4:"HlL?DV", 5:"vfGKXN"}
- ,51:{1:"umr!?I!J", 2:"7n63oR", 3:"&MC72?", 4:"72f$A1v", 5:"FiyB2FuzGA"}
- ,52:{1:"W$ahRf", 2:"ZRLafA4", 3:"jM%ozceVS", 4:"B4rYFo@42", 5:"c$x7X?a"}
- ,53:{1:"GaBoadbb", 2:"ew1%5e", 3:"F1$n2NSI4", 4:"jzSvgk@wO", 5:"21aEN%T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}}
- let illegal_characters = [34, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58, 59, 60, 61, 62, 91, 92, 93, 94, 95, 96, 123, 124, 125, 126, 127];
- let encrypted_text = "";
- let decrypted_text = "";
- let encrypting = false;
- let decrypting = false;
- document.getElementById("button_1").onclick = function(){
- //console.log("ENCRYPT");
- let inText = document.getElementById("text_input_1").value;
- console.log(inText);
- encrypt_text(inText);
- while(encrypting == true);
- document.getElementById("text_output_1").innerHTML = encrypted_text;
- console.log(encrypted_text);
- }
- document.getElementById("button_2").onclick = function(){
- console.log(encrypted_text);
- decrypt_text(encrypted_text);
- while(decrypting == true);
- document.getElementById("text_output_2").innerHTML = decrypted_text;
- console.log(decrypted_text);
- }
- function encrypt_text(in_text){
- encrypting = true;
- encrypted_text = "";
- for(let i = 0; i < in_text.length; i++){
- let c = in_text[i].charCodeAt(0);
- let random_pick = (1 + (Math.random()*4)).toFixed(0);
- encrypted_text = encrypted_text + data[c][random_pick];
- }
- encrypting = false;
- }
- function decrypt_text(in_text){
- decrypting = true;
- decrypted_text = "";
- let decrypters_chunk = [];
- let decrypters_character = [];
- for(let i = 32; i < 134; i++){ // iterate through characters
- for(let j = 1; j < 6; j++){ // iterate through 5 data samples
- if(data[i] != undefined){
- if(data[i][j] != undefined){
- let encrypt = data[i][j];
- let temp = in_text;
- while(temp.indexOf(encrypt) > -1){
- console.log(temp);
- decrypters_chunk.push(encrypt);
- decrypters_character.push(String.fromCharCode(i))
- temp = temp.replace(encrypt, "");
- }
- }
- }
- }
- }
- while(decrypters_chunk.length > 0){
- for(let i = 0; i < decrypters_chunk.length; i++){
- let encrypt = decrypters_chunk[i];
- if(in_text.indexOf(encrypt) == 0){
- decrypted_text = '' + decrypted_text + '' + decrypters_character[i];
- in_text = '' + in_text.slice(encrypt.length, in_text.length + 1);
- decrypters_chunk.splice(i,1);
- decrypters_character.splice(i,1);
- break;
- }
- }
- }
- decrypting = false;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement