Purpose: I'd like to shuffle a file system's blocks without loosing space so I thought if I formatted the disk to have exactly 2^32=4bn sectors, then a secure cipher with 32 bit wide data blocks could map all sectors to new ones without wasting place, like a hash map would do due to its collision chances.
Asked
Active
Viewed 884 times
1 Answers
10
A block cipher with any given key is always a permutation. It will map all possible inputs to all possible outputs. If it didn't, and multiple inputs mapped to a single output, then it wouldn't be reversible.
Note that a 32-bit block size is not secure for encryption, as Eugene Styer pointed out in a comment. This is not likely to be an issue if you're only using it to "shuffle" $2^{32}$ sectors. For this, you could use Speck32/64, which is a block cipher with a 32-bit block and a 64-bit key. Again, it is not secure.
forest
- 15,626
- 2
- 49
- 103