Created
May 17, 2018 00:39
-
-
Save getjump/3f8a7765530bd1e1d6017239aeb2bc50 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
| {% if page.encrypted %} | |
| {% asset jsencrypt.js %} | |
| <script> | |
| var storedEncrypted = ''; | |
| function decrypt() { | |
| var key = window.location.hash.substr(1); | |
| var text = storedEncrypted; | |
| var keyArray = sha256.update(key + _gj.salt).array(); | |
| var iv = aesjs.utils.hex.toBytes(_gj.iv); | |
| var encryptedBytes = aesjs.utils.hex.toBytes(text); | |
| var aesCbc = new aesjs.ModeOfOperation.cbc(keyArray, iv); | |
| var decryptedBytes = aesCbc.decrypt(encryptedBytes); | |
| $('#encrypted').html(aesjs.utils.utf8.fromBytes(decryptedBytes)); | |
| } | |
| $('document').ready(function () { | |
| storedEncrypted = $('#encrypted').text().trim(); | |
| if (window.location.hash == '') { | |
| return; | |
| } | |
| decrypt(); | |
| }); | |
| $(window).bind('hashchange', function () { | |
| if (window.location.hash == '') { | |
| return; | |
| } | |
| decrypt(); | |
| }); | |
| </script> | |
| {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment