Reference no: EM132112801
Python - Cryptograpy - Please include all #comments in before each row.
Cryptography is the science of making messages secure, of transforming readable messages into unreadable messages and back again. Messages that are unreadable are called cipher-text. The process of turning plaintext into cipher-text is called encryption. The reverse process of turning cipher-text into plaintext is called decryption.
One of the easiest ways to encrypt a message is to scramble the letters. For example, the word "apple" could be randomly transformed to "lapep." In fact, there are 120 different possible arrangements of the word "apple."
However, if the encryption algorithm randomly scrambles the letters, the task of the decryption algorithm is pretty hard. Encryption and decryption algorithms must work together in some agreed upon way, with the encryption algorithm scrambling letters and the decryption algorithm unscrambling them.
A transposition cipher is one way to scramble the letters of a message. The cipher separates the message into two groups of characters: the first group composed of the even-numbered characters and the second group composed of the odd-numbered characters.
To produce the cipher-text, the cipher puts together both groups; placing the group of the even-numbered characters first, followed by the group of odd-numbered characters. This encryption results in a string with the characters shuffled to new positions.
a) Write a python program that takes a message,encrypts the message as described above and returns the cipher-text.
b) Write a python program that takes as a cipher-text, decrypts the cipher-text as described above and returns the message.