Jump to content
MakeWebGames

A simple encryption / decryption and crack algorithm


a_bertrand

Recommended Posts

Ok, I had a bit of "free time" and decided I wanted to show something to my apprentice:

http://garg.web.nowhere-else.org/web/tutorials/Crypto.zip

This little code allows you to encrypt texts with a key and decrypt them. Yet the algorithm is as stupid as possible (replace a letter with another). What's fun if that if your text is in English and big enough (due to statistic counts at start) the soft is able to find back a key and therefore crack the code.

To do so, here are the steps:

- Count each characters and make a statistic of which is more used

- Compare the found statistic with the one known for the language as each language use differently the characters.

- Use the two most used characters and replace them with the 2 most used characters on the known language.

- From there on, try to match words which have unknown characters inside but which gives unique solutions like: "t?e" can be only "the" as "tee" would be 2x the "E" and there is no other words (in this dictionary) which are like that. Therefore learn slowly new characters and progress until all words are completed.

If you want you may try to code the same algorithm in other languages (PHP, JS, Java, Python) and we can then vote for the best implementation ;)

Link to comment
Share on other sites

Never said you must compete with me. It was more to see if any of you was able to code it in another language (as I know there is no reasons why it could not be done).

And indeed there is endless possibilities with such small toy ;) You could improve it a lot and try to hack yet more complex algorithms.

Link to comment
Share on other sites

  • 3 weeks later...

Nice concept alain, the possibilities are endless you could add non alphabetic characters and capital characters making the final output pretty hard to revert and end up with with an interesting string, am going to see what I can come up with.

Makewebgames should have a little non prized compo, which I havnt seen much of in the last few months

Hi by the way, havnt spoken to you in a long time

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...