Skip to content

Instantly share code, notes, and snippets.

@sachadee
Last active June 16, 2023 02:27
Show Gist options
  • Save sachadee/08098738d6a3edf9030603ee635053eb to your computer and use it in GitHub Desktop.
Save sachadee/08098738d6a3edf9030603ee635053eb to your computer and use it in GitHub Desktop.
AES ECB decryption in JavaScript
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<script>
var encrypted ='gfp6wzvTH3lN5TO2B37yWQ=='; //python is base64 ECB
var key ='AAAAAAAAAAAAAAAA'//key used in Python
key = CryptoJS.enc.Utf8.parse(key);
var decrypted = CryptoJS.AES.decrypt(encrypted, key, {mode:CryptoJS.mode.ECB});
console.log(decrypted.toString(CryptoJS.enc.Utf8));
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment