Re: [math-fun] A Permutation Cipher Text
Mike Stay <metaweta@gmail.com> wrote:
Keith F. Lynch <kfl@keithlynch.net> wrote:
Some years ago it occurred to me that exclusive-oring a text with a subset of the square roots, in binary, of the first N primes, followed by the above scrambling algorithm (in ASCII order), followed by the same exclusive-oring again, would be a pretty good encryption algorithm. Does anyone disagree?
The scrambling is irrelevant if the ciphertext has length N and the square roots of those N primes are GF(2)-linearly independent.
I'm assuming that the square roots of the primes, expressed in binary, are all normal ("patternless") and uncorrelated with each other (i.e. the exclusive-or of any subset of them is also normal), though as far as I know neither has actually been proven. (I'm speaking of the digits after the radix point only.)
Just apply Gaussian elimination and you've reduced the cipher to a one-time pad.
If N is less than the length of the ciphertext, then there will likely be exploitable statistical correlations.
N *is* less. It's just large enough that it's impractical to try all 2^N possible subsets of the first N primes, and will remain so for the foreseeable future. The main reason for the scrambling step is because I use the *same* subset of the primes for multiple files. (Well, almost the same. I append the low 24 bits of the file creation time (Unix time, seconds since 1970 began) to the subset.) Specifically, I hash, scramble, hash again, reverse-scramble, then hash again. This has the advantage that encryption and decryption are identical. Also, since it's an odd number of hashes (with the same subset), the number of 1-bits is not preserved, as it would be with an even number of hashes regardless of scrambling. "Hash" means exclusive-or the k-bit text with the first k bits of a subset of the first n primes exclusive-ored together. "Scramble" means reverse the text between each pair of identical characters, wrapping around so that the first and last characters aren't unmoved. I do this once for every character, in ASCII order. "Reverse scramble" is the same as scramble, but in reverse ASCII order. If what I'm proposing is sound, then scrambling would also allow for re-use of one time pads on multiple files.
On Sat, Oct 12, 2019 at 10:38 AM Keith F. Lynch <kfl@keithlynch.net> wrote:
If what I'm proposing is sound, then scrambling would also allow for re-use of one time pads on multiple files.
The whole point of a one-time pad is that it's information theoretically secure if you only use it once. If you don't care about that, then there are much better ways to encrypt things. If you use your pad on multiple files, there are chosen plaintext attacks that can recover the keys. (For example, consider plaintexts like aaaaaa...ab.) -- Mike Stay - metaweta@gmail.com http://math.ucr.edu/~mike https://reperiendi.wordpress.com
participants (2)
-
Keith F. Lynch -
Mike Stay