pycrypto - Why must all inputs to AES be multiples of 16? -


i'm using pycrypto implementation of aes , i'm trying encrypt text (24 bytes) using 24 byte key.

aes_ecb = aes.new('\x00'*24, aes.mode_ecb) aes_ecb.encrypt("123456"*4) 

i surprising error valueerror: input strings must multiple of 16 in length
why input must multiple of 16? make more sense me input string length must multiple of key size, because allow nice bitwise operations between key , blocks of plaintext.

aes block cipher. quote wikipedia page: “a block cipher deterministic algorithm operating on fixed-length groups of bits”.

aes can work blocks of 128 bits (that is, 16 chars, noticed).

if input can have lengths others multiple of 128, depending on application, may have extremely careful how handle padding.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -