Archived:Creating SMS decoder using PySymbian
This article shows how to decrypt an SMS that has been encoded using a Rail Fence Cipher. This is the companion article to Archived:Creating SMS encoder using PySymbian, which explains how you can encode and send an SMS message.
Introduction to Rail Fence Cipher
The Rail Fence Cipher involves writing messages so that alternate letters are written on separate upper and lower lines. The sequence of letters on the upper line is then followed by the sequence on the lower line, to create the final encrypted message.The security of the cipher can be improved by choosing more than two lines to encrypt your message with.
For example if you want to send the message - "Meet me urgently" than this message will be coded as shown here
M . e . . e . u . g . n . l . . e . t . m . . r . e . t . y
As shown above the message is written on the two separate line by writing alternate character on different line and than this two lines are combined to create a final encrypted message as
Me eugnletm rety
The name of this cipher is given from the way the message is written here. It is written like a fence on the rail platform hence the name of this cipher is rail fence cipher.
The code given here assume that the last message you received is the encoded one and decode that message only. Very soon i will upgrade the code to read all message in your inbox and find out which message is the encoded one.
To use this code first use read message option which will shows you encoded message and than use decode message option to read the original message(decoded one).
Algorithm use to decode SMS
- First divide the received message in two equal parts.
- Now from both these part read one by one character in a sequence and arrange them in a new array.
- Join all this character and your decoded message is ready to display.
- See also SMS encoder
appuifw.note(u'First read message and than try to decode',"error")
for i in range(k):
app_lock = e32.Ao_lock()
round = appuifw.Text()
appuifw.app.body = round
appuifw.app.menu = [(u"Read message", read),(u"Decode message",decode)]
appuifw.app.exit_key_handler = exit_key_handler
Following are some screenshots of the above script:
- First you have to read the message:
- Next you can decode the message to get the actual message.