number of blocks, and size of padding at 64bit A message has 2003 characters, encrypted using a block cipher of 64 bits. What is the size of the padding and the number of blocks?


I tried this, but I'm sure it's not the right thing:


2003 mod 64 = 19, this is the number of bits that needs padding.
2003 / 64 = 31, this is the number of complete blocks, this + 1 = 32 is the total number of blocks.
As written, this exercise is ambiguous, since we don't know how many bits make one character, or even if this number is constant or not.  (For e.g. Unicode text using the UTF-8 encoding, it's not &mdash; one character can take up between 1 to 4 bytes, or 8 to 32 bits.)

However, if we assume that one character = one byte = 8 bits, then the message has 2003 &times; 8 = 16024 bits.  This amounts to 250 (= 16000 / 64) full 64-bit cipher blocks, and 24 bits (= 3 bytes) left over, for a total of 251 blocks (= 251 &times; 64 = 16064 bits) after padding.

(A perhaps simpler way to calculate this is to note that 64 bits = 8 bytes, and that 2000 is a multiple of 8.  Thus, the message has 2000 / 8 = 250 full blocks and 3 extra bytes, giving a total of 2008 bytes after 5 padding bytes have been appended to round the length up to the next multiple of 8 bytes.)