Comments

_anonymousxx

Report

Hello, I'm new to programming and I've started with Python. I'd really appreciate it if you could help me with this question?

A company wants to transmit data over the telephone, but it is concerned that its phones may be tapped. All of its data are transmitted as four-digit integers. It has asked you to write a program that will encrypt its data so that the data may be transmitted more securely.

The encryption process proceeds as follows:

Replace each digit by (the sum of that digit plus 7) modulus 10. Then swap the first digit with the third, and swap the second digit with the fourth. The integer obtained will be the encrypted integer.

You are to implement this encryption by writing a function named encrypt that will accepts a four-digit integer as parameter and return the encrypted integer to the caller.

Write another function named decrypt that accepts an encrypted four-digit integer and decrypts it to form the original number.

Implement both the methods in a program/module named security.py. Include in this module the main function that will prompt user for original data and invoke the encrypt function for encryption, and invoke the decrypt function for decryption by passing the encrypted integer. In both cases, you are to display the result, in exactly 4-digit format.