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


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)

  • 4
    $\begingroup$ 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. $\endgroup$
    – Thomas
    Jul 23, 2013 at 2:49
  • 1
    $\begingroup$ 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. $\endgroup$
    – e-sushi
    Jul 31, 2013 at 21:09

1 Answer 1


You can try NSA's CryptoKids page (archived here). It's been around for some years and the ciphers have varying difficulty so you might at least get some ideas.

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.