Skip to content

Instantly share code, notes, and snippets.

@zodman
Created July 6, 2012 18:03
Show Gist options
  • Save zodman/3061687 to your computer and use it in GitHub Desktop.
Save zodman/3061687 to your computer and use it in GitHub Desktop.
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