# Toy encryption system that provides “hints”

I'm looking for a toy encryption system that has a specific property that when decrypting it with a key that is close enough to the key used in the encryption, it will produce some of the original plain text.

The idea is to use it as a game/teaching system where kids can try to break a cyphertext but instead of using cryptanalisys on the cyphertext, I want them to try different keys and then the decrypted text would provide feedback as of how close the key really is, for example:

I encrypt

attack at dawn with key 1234

and let's say the cyphertext is

ABCDEFGHIKLMN

now, if I try to decrypt the cyphertext with key, for example, 1288, it should display some of the plaintext, in order to hint the breaker that the key is somewhat close to the real one

think of it as an encryption system a la Mastermind

A simple substitution cipher kind of does the trick, but I'm wondering if there are other ciphers that behave that way (preferrable with smaller key space)

-
One thing that comes to mind is the Vigenere cipher. If you get a few of the key characters right, some of the plaintext characters are revealed. Eventually you can work out the rest of the key by taking guesses at possible plaintext words (though a more powerful and general solution exists). That said the "key distance" isn't like the one in your example (e.g. you'd have keys "CRYPTO" and "CRYPTA" instead of 1234 and 1288) but their Hamming distance should do fine as a metric. – Thomas Jul 23 '13 at 2:49
Something that might be interesting to you too is the CrypTool portal (www.cryptool.org/en/), which offers e-learning software for teachers and pupils. – e-sushi Jul 31 '13 at 21:09

Alternatively you can use plain XOR encryption with a twist: Encrypt multiple consecutive letters with the same character. For example, if $|m|=n$ then $|k|=n/4$ and do $c_i,...c_{i+4}=k_i \oplus m_i,...,m_{i+4}$. That should give good feedback with every correct guess.