Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Where i can find a "reviewed" version of AES implementation in python. Not an API like PyCrypto whereby you can call AES algorithms in a single line.

share|improve this question

closed as off-topic by e-sushi Jul 16 at 14:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

2  
What do you mean by reviewed? Tested with the NIST CMVP? I can provide a pure python AES implementation, but its just a learning tool, not meant for actual usage – calccrypto Jan 16 '13 at 14:51
2  
As a programming question, this might be better off at stackoverflow. – Maarten Bodewes Jan 18 '13 at 23:41
up vote 8 down vote accepted

This is an implementation of AES written completely in Python.

It's not written as a library, it's a program to encrypt files, but looking at the source (which is a single file) the entire AES workings are implemented within it.

There are publicly available test vectors from CMVP for validating that an AES implementation conforms to the spec properly. However, this alone does not address the many pragmatic problems an implementation may have.

share|improve this answer

Have a look at pyCrypto. It is also linked by the official python doc. As you can see in the pyCrypto doc it implements the following encryption algorithms:

AES 16, 24, or 32 bytes/16 bytes
ARC2 Variable/8 bytes
Blowfish Variable/8 bytes
CAST Variable/8 bytes
DES 8 bytes/8 bytes
DES3 16 bytes/8 bytes
IDEA 16 bytes/8 bytes
RC5 Variable/8 bytes

As you already pointed out:

Some modules are implemented in C for performance; others are written in Python for ease of modification. Generally, low-level functions like ciphers and hash functions are written in C, while less speed-critical functions have been written in Python.

There are also some interesting tutorials:

[update] found a python implementation of aes here and here. I did not verify if it works well.

share|improve this answer
    
AES.c, that's unlikely to be python. – Maarten Bodewes Jan 18 '13 at 23:40

Take a look at tlslite, it offers an AES implementation. The API seems to support CBC mode only though.

https://github.com/trevp/tlslite/blob/master/tlslite/utils/python_aes.py

share|improve this answer

I maintain the fastest implementation of pure Python aes

It's reviewed in so far as it passes unit tests in __main__. Patches for more thorough testing are welcome. My fork of pythonaes made the decision that it's the crypto kernel to the point that it requires prepadded input

share|improve this answer
2  
fastest – any reference providing proof to that? (Just in case someone comes around doubting that claim. It never hurts to have a reference to point to when it comes to things like that.) – e-sushi Jul 16 at 14:56
1  
Someone else making the claim . Otherwise one can read the code to see that the lengths gone through to avoid allocations. It could get faster by inlining cipher code into modes to avoid an extra BUILD_TUPLE/UNPACK pair per block – Demur Rumed Jul 16 at 15:17
    
I have a Python code for AES that is certainly not very fast but on the other hand highly closely follows the NIST document and hence is very easy to be checked to be correct by the users. See s13.zetaboards.com/Crypto/topic/7385224/1/. – Mok-Kong Shen Jul 16 at 15:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.