Skip to content

Instantly share code, notes, and snippets.

@py7hon
Created April 3, 2020 13:24
Show Gist options
  • Save py7hon/b7fdb21a195b74590d7e7ccd548be306 to your computer and use it in GitHub Desktop.
Save py7hon/b7fdb21a195b74590d7e7ccd548be306 to your computer and use it in GitHub Desktop.
secure image with AES encryptions
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
</head>
<body>
<img src="" id="thumb"/>
<script type="text/javascript">
function decrypt(message= '', key = ''){
var code = CryptoJS.AES.decrypt(message, key);
var decryptedMessage = code.toString(CryptoJS.enc.Utf8);
return decryptedMessage;
}
document.getElementById("thumb").src = decrypt('YKrdXF1ve6nDqW2Fp7+Z7bBj1Afn1Se4SobShzztnU1/1ByGJV8n5N4SvlKBnxdm', 'QfTjWnZr4u7x!A%D*G-KaPdRgUkXp2s5');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment