[Back] A block cipher, such as AES and DES, involves taking a number of bits in a block and then ciphering each block. DES uses 64-bit blocks while AES uses 128-bit blocks.
ASCII characters are 8 bits long. If we use a 32-bit block size, we can get 4 characters. For a 64-bit block size, we get 8 characters. The following outlines the code:
import sys BLOCKSIZE = 8 n=BLOCKSIZE message="hello how are you?" message = [message[i: i + n] for i in range(0, len(message), n)] lengthOfLastBlock = len(message[len(message)-1]) if ( lengthOfLastBlock < BLOCKSIZE): for i in range(lengthOfLastBlock, BLOCKSIZE): message[len(message)-1] += " " i=0 for b in message: print 'Block [',i,']',b i=i+1