0
$\begingroup$

I am trying to decrypt a text data encrypted with a simple substitution method with 2 steps. First, shift the alphabet of the source text by a few characters.

For example, if we shift by 2 characters, Hello, world! becomes Jgnnq, yqtnf!.

Secondly, Substitute space (" ") with a lower case alphabet. For example, when g and " " are to be replaced, Jgnnq, yqtnf! becomes ultimately encrypted to J nnq,gyqtnf!. Now, I am having trouble with finding which character is used to replace " ". I was thinking of using the character with the highest occurrence frequency (except e, since e has the highest frequency in the English language). But I found that it may not work always.

Does anyone has any idea how to

$\endgroup$
  • $\begingroup$ Accept ` ` (space) as also a letter? So instead of 26 you will have 27 letters. $\endgroup$ – kelalaka Jan 8 at 18:12
  • $\begingroup$ @kelalaka you are correct. $\endgroup$ – Ahashan Alam Sojib Jan 8 at 18:55
  • $\begingroup$ Clearly, the letter that has been swapped with space is the one that appears after commas. ;) $\endgroup$ – fkraiem Jan 8 at 20:08
  • $\begingroup$ @fkraiem I also thought of this approach. but what happens when there is no comma or semi-colon in the text and the text is one line sentence? $\endgroup$ – Ahashan Alam Sojib Jan 9 at 1:43
  • $\begingroup$ Other approach: try to reverse the shifting first... $\endgroup$ – fkraiem Jan 9 at 1:48

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.