Created
August 15, 2020 15:30
-
-
Save 0awawa0/34dcaadbfc94f68edf11c133baaf0203 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
document.getElementById('neville-locker-form').addEventListener('submit', function(e) { | |
e.preventDefault(); | |
var passphrase = document.getElementById('passwd').value, | |
encryptedMsg = '4cce4470203e10b395ab1787a22553a5b2503d42a965da813676d929cc16f76cU2FsdGVkX19FvUyhqWoQKHXNLBL64g8acK4UQoP6XZQ/n4MRL3rgQj8TJ/3r8Awtxte2V9s+RLfQHJOHGwYtctqRa/H2BetmxjwGG+LYKUWC8Z6WBoYbecwtATCOuwewnp+VKBzsWLme+3BZyRgKEA==', | |
encryptedHMAC = encryptedMsg.substring(0, 64), | |
encryptedHTML = encryptedMsg.substring(64), | |
decryptedHMAC = CryptoJS.HmacSHA256(encryptedHTML, CryptoJS.SHA256(passphrase).toString()).toString(); | |
if (decryptedHMAC !== encryptedHMAC) { | |
alert('Bad passphrase!'); | |
return; | |
} | |
var plainHTML = CryptoJS.AES.decrypt(encryptedHTML, passphrase).toString(CryptoJS.enc.Utf8); | |
document.write(plainHTML); | |
document.close(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment