Created
July 6, 2012 18:03
-
-
Save zodman/3061687 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
from Crypto.Cipher import AES | |
from encoder import PKCS7Encoder | |
import base64 | |
#declared outside of all functions | |
key = '################' | |
mode = AES.MODE_CBC | |
iv = '\x00' * 16 | |
print (iv,) | |
encryptor = AES.new(key, mode, iv) | |
encoder = PKCS7Encoder() | |
text = "andres " | |
pad_text = encoder.encode(text) | |
cipher = encryptor.encrypt(pad_text) | |
enc_cipher = base64.b64encode(cipher) | |
print enc_cipher | |
zodman $ python zoden.py | |
('\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',) | |
9wdfVe3qPv00IZ7McPX9IfLrlWESGPVbeGiSeRaAxOA= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment