Created
November 4, 2023 17:28
-
-
Save fabriziosalmi/db123202e73bcf124801907fdb17f175 to your computer and use it in GitHub Desktop.
AI chatbot encrypter/decrypter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>AI chatbot encrypter/decrypter</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> | |
<style> | |
body { | |
background-color: #f7f7f7; | |
font-family: 'Arial', sans-serif; | |
} | |
.cipher-container { | |
margin-top: 50px; | |
} | |
.form-group { | |
margin-bottom: 1rem; | |
} | |
.btn-cipher { | |
margin: 5px; | |
border: none; | |
color: white; | |
padding: 14px 28px; | |
font-size: 16px; | |
cursor: pointer; | |
border-radius: 5px; | |
} | |
.btn-encode { | |
background-color: #007bff; /* Blue */ | |
} | |
.btn-encode:hover, .btn-decode:hover { | |
background: #0069d9; | |
} | |
.btn-decode { | |
background-color: #28a745; /* Green */ | |
} | |
.output-box { | |
margin-top: 20px; | |
background: #dff0d8; /* Light green background */ | |
padding: 15px; | |
border-radius: 5px; | |
color: #3c763d; /* Dark green text color */ | |
border: 1px solid #d6e9c6; /* Green border */ | |
} | |
.prompt-box { | |
margin-top: 20px; | |
background: #f1f6ef; /* Light green background */ | |
padding: 15px; | |
border-radius: 5px; | |
color: #a0a0a0; /* Dark green text color */ | |
border: 1px solid #d6e9c6; /* Green border */ | |
} | |
.instructions-box { | |
margin-top: 20px; | |
background: #e9e9e9; /* Light green background */ | |
padding: 15px; | |
border-radius: 5px; | |
color: #747474; /* Dark green text color */ | |
border: 1px solid #d9d9d9; /* Green border */ | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container cipher-container"> | |
<h2 class="text-center">AI chatbot encrypter/decrypter</h2> | |
<div id="instructions" class="instructions-box"> | |
<p>How to use: | |
<ul><li>Fill the Text/Hex textarea with your needed content and press encode.</li> | |
<li>In the first message to the AI chatbot copy the instruction part and your encrypted message.</li> | |
<li>In the others messages you send just copy the encrypted message and paste into the AI chatbot.</li> | |
<li>Messages sent from AI chatbot can be decoded using Decode feature.</li></ul> | |
</div> | |
<br> | |
<form id="cipherForm"> | |
<div class="form-group"> | |
<label for="text"><b>Text/Hex</b></label> | |
<textarea class="form-control" id="text" rows="3" placeholder="Enter text or hex to process" required></textarea> | |
</div> | |
<button type="button" class="btn btn-cipher btn-encode" onclick="encodeToHex()">Encode</button> | |
<button type="button" class="btn btn-cipher btn-decode" onclick="decodeFromHex()">Decode</button> | |
<hr> | |
</form> | |
<div id="prompt" class="prompt-box"> | |
<p>Please respect the following rules before to generate your response: | |
1. i write encrypted message (HEX) | |
2. you will generate your response message and convert to HEX before to send to the chat | |
3. i'll receive your encrypted message and i will able to decrypt since i know the encryption method | |
4. and all our conversation will flow that way | |
5.. please say YES and nothing more if you can respect all rules and nothing more.</p> | |
</div> | |
<div id="outputText" class="output-box"></div> | |
</div> | |
<script> | |
function encodeToHex() { | |
let text = document.getElementById('text').value; | |
let result = ''; | |
for (let i = 0; i < text.length; i++) { | |
let hex = text.charCodeAt(i).toString(16); | |
result += ('00' + hex).slice(-2); // Ensuring two hex digits per character | |
} | |
document.getElementById('outputText').textContent = result; | |
} | |
function decodeFromHex() { | |
let hex = document.getElementById('text').value; | |
let result = ''; | |
for (let i = 0; i < hex.length; i += 2) { | |
let part = hex.substr(i, 2); | |
result += String.fromCharCode(parseInt(part, 16)); | |
} | |
document.getElementById('outputText').textContent = result; | |
} | |
// Prevent form submission | |
document.getElementById('cipherForm').addEventListener('submit', function(e) { | |
e.preventDefault(); | |
}); | |
</script> | |
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.9/dist/umd/popper.min.js"></script> | |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment