Pure Python implementation of AES for 2.7 or 3.x
Clone or download
Pull request Compare This branch is 32 commits ahead, 5 commits behind caller9:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
aespython
.editorconfig
.gitignore
.travis.yml
demo.py
readme.md
setup.py

readme.md

Build Status

This repo is the pure speed fork of caller9's original library. This version does not handle padding. It implements CBC, CFB, & OFB

# given a key, iv, & blocksize
from aespython import expandKey, AESCipher, CBCMode
expandedkey = expandKey(key) # key must be of length 16, 24, or 32
cipher = AESCipher(expandedkey)
cbc = CBCMode(cipher)
cbc.set_iv(iv) # iv must be of length 16

# user is responsible to make sure data is padded to a multiple of 16 in length
encryptedblock0 = cbc.encrypt_block(data[0:16])
encryptedblock1 = cbc.encrypt_block(data[16:32])