Could any text be converted into any other text if you could find the right encryption code? For example, is there some encryption string that would convert the book of Genesis into the opening chapters of Moby Dick, or vice-versa? Or is this one of those class of “not known to be solvable” mathematical problems?

It’s trivially easy to show this works character-by-character. (You wind up with an encryption key the same length as the text.)

Depends on what you mean by “the right encryption code”. There are infinitely many functions that map Genesis to Moby Dick, but it’s not immediately obvious that any of the non-trivial ones are computable. I’m not sure that **Xema**’s suggestion will work if the input text and the desired output text are of different lengths.

:smack: Duh. Now a really tough one: why do obvious answers only occur to you after you’ve asked the stupid question?

If the input text is longer, then you can just make sure that a possible output for a character is NULL. If the input text is shorter, you just have to duplicated it enough times that it’s longer, then do the same thing.

Using that simple algorithm, and a key as long as the (modified) input text, it’s trivial.

Kolmogorov defined “conditional complexity” in Algorithmic Information Theory. Given a string x, how small can you compress string y. This is basically what you are talking about.

As noted, of course you can do it by just ignoring the other text. But can you “do it better” if you don’t?

Note that both your example texts compress reasonably well. The question is: given one can you compress the other even more?

IMHO, not really. There just isn’t that much “unusual text” that would be common to both. E.g., if several thousand character random strings appearing in both, then you’d be gold. Ahab doesn’t appear in Genesis and Ishmael doesn’t come along until Chapter 16. Starbuck isn’t in Genesis at all. None of which are long of enough to help at all anyway. (Insert smiley number 473.)

For the most cryptographically secure system, the one-time pad, yes, this is trivial. All you need to do is choose your one-time pad (the key) correctly, which again is quite computationally feasible. You could even do it with a pen and paper; there’s very little math involved, but it would take a while to encrypt one character at a time.

But note that to be secure, the one-time-pad key must be chosen at random. In this case, the key is determined by the plaintext and the crypto text (so it can’t properly be considered a one-time pad).

Yes, but then again, what the OP is asking for can’t properly be considered to be encryption.