Skip to content

Instantly share code, notes, and snippets.



Created Jul 16, 2014
What would you like to do?
Encode and decode mails
<!DOCTYPE html>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" href="" />
<style type="text/css">
html, body {
height: 100%;
width: 100%;
#tab {
list-style-type: none;
#tab > li {
display: inline;
<p><label>Mot de passe : <input type="text" id="password"></input></label></p>
<p><textarea id="text" rows="24" cols="80"></textarea></p>
<input type="button" id="decrypt" value="Déchiffrer"/>
<input type="button" id="encrypt" value="Chiffrer"/>
<p id="result"></p>
<script src="aes.js"></script>
<script type="text/javascript">
var dec = document.getElementById('decrypt'),
enc = document.getElementById('encrypt'),
pass = document.getElementById('password'),
text = document.getElementById('text'),
result = document.getElementById('result');
dec.addEventListener('click', function onClick() {
result.innerHTML = CryptoJS.AES.decrypt(text.value, pass.value).toString(CryptoJS.enc.Utf8).replace(/\n/gm, '<br />');
enc.addEventListener('click', function onClick() {
var crypted = CryptoJS.AES.encrypt(text.value, pass.value).toString().replace(/\n/gm, '<br />');
result.innerHTML = "Pour lire ce message, copiez son contenu dans le formulaire sur" + crypted + "<br />";
result.innerHTML += "Mot de passe : " + pass.value + "<br \><br \>";
result.innerHTML += "Message :<br \><br \>"+ crypted;
if (window.location.hash !== "") {
text.value = window.location.hash.substr(1);
INPUT=$(cat /dev/stdin)
export PASS=`openssl rand -base64 6`
TXT=`printf "%s\n" "$INPUT" | openssl enc -aes-256-cbc -pass env:PASS -e -base64 -A`
echo -e "Pour lire ce message, copiez son contenu dans le formulaire sur$TXT";
echo -e "Mot de passe : $PASS\n\nMessage :\n\n$TXT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.