There are approaches to storing encrypted information that eliminate the need for any addition if the data size is at least equal to the size of the block. One small difficulty is that if the data size can be smaller than the block size, and if you need to restore the exact size of the data, even for small blocks, the output must be at least one bit larger than input, [i] regardless of [/ i] data size.
To understand the problem, understand that there are 256 NN files whose length is N bytes, and the number of possible files of no more than N bytes is 256 ^ N plus the number of possible files that are not longer than N-1 bytes (there is one possible file of length 0 bytes and 257 possible files with a length of not more than one byte).
If the block size is 16 bytes, then 256 ^ 16 + 256 ^ 14 + 256 ^ 13, etc. will be available. possible input files with a length of no more than 16 bytes, but only 256 ^ 16 possible output files that are no more than 16 bytes (since the output files cannot be shorter than 16 bytes). Thus, at least some possible 16-byte input files should grow. Suppose they become 17 bytes. There are 256 ^ 17 possible seventeen byte output files; if any of them is used to process inputs of size 16 bytes or less, there will not be enough available to process all possible 17-byte input files. No matter how large the input can get, some files of this size or larger should grow.
supercat Jul 19 '10 at 20:15 2010-07-19 20:15
source share