PyCrypto and AES: can i use a longer key than the block size (16byte)? I see that in many scripts are used keys of 16 characters for a block of 16 byte, but can I use key of 40 (for example)? And then why in some scripts with aes module the block size is set to 32 byte if aes can handle a fixed size block of 128 bit? Is it correct?
I see that in many scripts are used keys of 16 characters for a block of 16 byte, but can I use key of 40 (for example)?


No, AES uses a key size of 128, 192 or 256 bits. That's 16, 24 or 32 bytes.


  And then why in some scripts with aes module the block size is set to 32 byte if aes can handle a fixed size block of 128 bit? Is it correct? 


No, that's not correct. It could however be that the module implements Rijndael instead of AES. AES is a subset of Rijndael, and Rijndael can have the block sizes 128, 160, 192, 224 and indeed 256 bits. So in that case the block size can be 256 bits.



Notes:


not all implementations of Rijndael offer support for 160 and 224 bit block and key sizes (so many posts don't mention these block and key sizes);
bytes are not characters, although the name of a byte in C/C++ is traditionally called a char as for ASCII each character is represented by exactly one byte - no conversion necessary;
sometimes when characters are mentioned they actually contain hexadecimal digits; as you need two hexadecimal digits to represent one byte it may seem that 256 bits are used instead of the actual 128 bits.