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
import base64 | |
from Crypto.Cipher import AES | |
from Crypto.Util.Padding import pad,unpad | |
#AES ECB mode without IV | |
data = 'I love Medium' | |
key = 'AAAAAAAAAAAAAAAA' #Must Be 16 char for AES128 | |
def encrypt(raw): |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script> | |
<script> | |
//PYTHON FIX IV ENCRYPTION AND PYTHON FIX IV | |
var Base64CBC ='VEX7Eequ5TM9+jlgrwnkNw=='; | |
var iv = CryptoJS.enc.Utf8.parse('BBBBBBBBBBBBBBBB'); | |
//PYTHON RANDOM IV ENCRYPTION AND PYTHON RANDOM IV | |
//var Base64CBC ='uJrS9Zp1R5WjOEUkSK9clQ=='; | |
//var iv = CryptoJS.enc.Base64.parse('l5I5Toqn5RoX0JfTLQB9Pw=='); | |
var key ='AAAAAAAAAAAAAAAA'//key used in Python | |
key = CryptoJS.enc.Utf8.parse(key); |
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
<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> |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script> | |
<script> | |
//JS FIX IV ENCRYPTION CBC | |
var message = 'I love Medium'; | |
var key ='AAAAAAAAAAAAAAAA'//key used in Python | |
key = CryptoJS.enc.Utf8.parse(key); | |
var iv = CryptoJS.enc.Utf8.parse('BBBBBBBBBBBBBBBB') | |
var encrypted = CryptoJS.AES.encrypt(message, key, { iv: iv, mode: CryptoJS.mode.CBC}); | |
encrypted =encrypted.toString(); | |
console.log('encrypted',encrypted ); |
NewerOlder