You can always devise clever solutions like this. However, it may dramatically increase the length of the string.
As a trivial example, you could make an encryption scheme which takes your messages ("test1", "test2"), encrypts them with each key and concatenate the results, along with the hash of each message and enough message-length information to break the message back into pieces later
Enc(M1, M2, K1, K2) = Concat(Hash(M1), Hash(M2),
Length(Enc(M1, K1)), Enc(M1, K1),
Enc (M2, K2))
For decryption, say with key1, you split the cypher message up, and decrypt both halves with the same key. One of them will produce "test1" and the other will produce gobldygook (beacuse the other half was encrypted with key2). Checking the hashes, you'll confirm that "test1" was decrypted properly.
Interestingly enough, this also permits deniable encryption. If you only have one key, and simply use random data for the "encrypted second message" and a random hash, nobody can prove that there is or is not a key which decrypts the second message.
Myself, I find this sort of pattern more interesting in polyglot language problems. They're not encryption, but they're fun. For example:
(*a/*/ % #)(PostScript)/Helvetica 40 selectfont 9 400 moveto show%v"f"a0
true showpage quit%#) 2>/dev/null;echo bash;exit #*/);int main()/*>"eb"v
That's a program which can be executed in multiple languages. In each language, it prints out the name of the language:
- Post Script
There's also a fascinating example of a program on PCG which outputs a different number for each of the 65 languages that it can run in! How's that for different keys!