Honesty commands me straight away to say that I'm not a professional, but I'm fascinated by data encryption. This algorithm won't be used in production code, so please don't flood me with "Don't design your own crypto", I know. I apologise in advance if the question is unfit for this site.
I was wondering how secure the following encryption algorithm would be. It would take:
- a 256-bytes long key, to be interpreted as a series of numbers.
- data to be encrypted, read in 256-bytes long blocks.
The key is such that no two values are repeated, and all values should be in the 0x00–0xFF range. This means there's 256! possible combinations, if I'm not wrong. Yet, some of those combinations are more entropic than others – which makes some of them less useful, right?
Now, a copy of the data chunk is made, and the key is iterated on. The first byte in the original data chunk is moved to the first value in the key; the second, to the second value in the key, and so on.
for index, destination in enumerate(key): data_enc[destination] = data[index]
Not being a substitution cipher, it should be harder to guess which value is which. Yet, I am aware that the substitution is always the same throughout the data, so that surely counts as a weakness.
The main weakness is its simplicity, I suppose. What do you think?