What are Alternatives to basic ROT-n Ciphers which Don't Lose 'Context'? I've got this neural network running like a champ on my machine.  The data is concatenated works of shakespeare in a plaintext file.  RNN trains on the data, then gives you a 'sample', aka it tries to freestyle its own shakespeare based on what it has learned.

So now I've encrypted the dataset with a standard mid ROT cipher, and gave that to the NN to train on.  Which it did, and it returned a result which was ROT ciphered.  Decrypting that yielded valid results. As it should have, training on data that kept all its 'context', without randomness, unpredictability, or 'fuzz'.  Not sure if those are the exact words, but you get it.

I'm wondering if there are any other ciphers, or really any other algorithms like compression schemes or what have you, that may yield the same results as my previous experiment?  That training on its encrypted data would likely yield a sample that could then be decrypted accordingly?  Or would most other stuff be 'lossy' in some way?
Any letter (simple) substitution cipher will do (it might be necessary that it special-cases any character that your text-generating software special-cases, like space, tab, linefeed, perhaps punctuation).

ROT-n is a particular case of substitution cipher, with a much smaller key set (if we restrict to uppercase letters, ROT-n has $26&lt;2^5$ keys, versus $26!&gt;2^{88}$ keys for a general substitution cipher; that less than 5 bits versus more than 88).

Depending on what the text-generating software does, it might also work to substitute words, in addition to letters. That further increases the key space.

Substitution ciphers are hopelessly insecure, thus it is unclear what this achieves, or what is attempted.