Created
April 3, 2018 11:19
-
-
Save tomrockdsouza/687a2422e8758a656ab770d9300c6f07 to your computer and use it in GitHub Desktop.
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> | |
<head> | |
<script type="text/javascript" src="https://cdn.rawgit.com/ricmoo/aes-js/e27b99df/index.js"></script> | |
<script> | |
function decryptAES(encryptedHex){ | |
// An example 128-bit key | |
var key = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]; | |
// The initialization vector (must be 16 bytes) | |
var iv = [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,35, 36 ]; | |
// When ready to decrypt the hex string, convert it back to bytes | |
var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex); | |
// The cipher-block chaining mode of operation maintains internal | |
// state, so to decrypt a new instance must be instantiated. | |
var aesCbc = new aesjs.ModeOfOperation.cbc(key, iv); | |
var decryptedBytes = aesCbc.decrypt(encryptedBytes); | |
// Convert our bytes back into text | |
var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes); | |
return decryptedText; | |
// "TextMustBe16Byte" | |
} | |
</script> | |
</head> | |
<body> | |
<a id="link" href="" ></a> | |
<script> | |
link=decryptAES(document.location.hash.substring(1)).replace(/@/g, ''); | |
document.getElementById("link").href=link; | |
document.getElementById("link").innerHTML=link; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment