Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

InfinitySquared

Substitution Cipher

This topic is 5279 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to code a program that will take any legitimate cipher and decrypt it using either a rotational or a substitution based method. I was able to get the rotational part working using the Chi-Square statistic, but I''m completely stumped on using substitution. The only thing I have access to is a dictionary. Can someone give me some general ideas on program logic I should use? Just randomly guessing combinations and comparing to dictionary entries seems really inefficient as the program has to complete the decryption in 30 seconds or less. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
If you know its just a simple mapping from character to character, one thing you could do is use character statistics to assist. For example, ''e'' is the most common letter in english writing, so you could presume the most common character in the cipher text is E. If you had your program first analize several texts (or did so and hard coded the table when making the program), you could know which characters are probably what and use that as a starting point. Once you have a few letters (even just ''e'' and space), you can start trying to find words. The ''potential words'' you find (using pattern matching, treating unknown characters as a ''match any single character'' wildcard) can further assist you in figuring out which letters transform into what.

Of course, that all assumes the plain text will be regular english text and not something specially designed to be hard to decrypt (which it could be since it sounds like this is for a contest)

Share this post


Link to post
Share on other sites
It sounds like you need to gather some frequency statistics from your dictionary first. I wont say a single word more as this sounds like an assignment.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!