Created
April 24, 2017 08:02
-
-
Save LeonardoCiaccio/b48f0c5e3dd154862cf69bfd6a17480e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Full working sample actually is: | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script> | |
| <br><br> | |
| <label>encrypted</label> | |
| <div id="demo1"></div> | |
| <br> | |
| <label>decrypted</label> | |
| <div id="demo2"></div> | |
| <br> | |
| <label>Actual Message</label> | |
| <div id="demo3"></div> | |
| <script> | |
| var encrypted = CryptoJS.AES.encrypt("Message", "Secret Passphrase"); | |
| //U2FsdGVkX18ZUVvShFSES21qHsQEqZXMxQ9zgHy+bu0= | |
| var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase"); | |
| //4d657373616765 | |
| document.getElementById("demo1").innerHTML = encrypted; | |
| document.getElementById("demo2").innerHTML = decrypted; | |
| document.getElementById("demo3").innerHTML = decrypted.toString(CryptoJS.enc.Utf8); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment