Format of Report
Format of Report
(CyS101) Class
Name:Ahmed yaqoob
An encrypting program This program prevents others from stealing your data
by encrypting it
Table of contents
1|Page
I. Introduction
In those days its all about your security so we decided to make a simple encrypting program that works
with a simple python codes to save your data
We aim to safe data transferring between devises using our encrypting methods
1. Read function
This function reads the data that stored in the given file to give access to edit and encrypt data
stored inside it by using open and ‘r’ to read the file and save it to “content” and return it
2. Write function
This function takes to variables first one is the text and the second one is file path and saves the
text data to the file path by using open and ‘w’ to write
2|Page
3. Encrypt function
Tis function is the main function in the program it takes a string text and generates a random
number to be the key of encryption
We add the encryption kay to the first of our string data to use it later in the decryption
progress
Random_char is a string that have a copal of string characters that will be used to encrypt the
data
The firs for loop rotate in the count of the data characters (lent(text)+1) we use +1 because
the index starts from 0
Identifying a new string to contain the encrypting string and filling it with for loop that rotate
in the range of the encryption key that is changes randomly every new run
After that we add the first later of our text and the encryption string together and store it in
the final text and loop every think again until all text characters do encrypt
3|Page
4. Decrypt function
To decrypt the text me do identify a new string called final text and an integer called decrypt
key to store the key
We start a loop from 0 to text length and make sure that I is not 0 by including a if statement
In the second if we ask if the mood of decrypt key +1 is equal to == that means this index is
for the original text that we have encrypted before
We add the text character with the I index to our final text and loop again until the text is
done
4|Page
While true to make the program loops until we exit and taking the first input for the
operation choice
If the choice equal to 0 ask the user for the file path and extract the file content using the read
function after that we print the file content and encrypt the file and print the encrypted
content
And give another choice to save and un save the file and the else for the incorrect input like
liters and numbers that not identified
5|Page
The second choice elif == 1 we decrypt the contents of the file and ask for save like the
privies one
Third choice is used for breaking the while loop and exit the program
And else if the user didn’t enter one of the rite options the program prints that he enter
incorrect input
6|Page
III. Results (Running of Python Code)
At the begging of the program it asks u to chose if u want to encrypt or decrypt the file
After giving the file path is Shows you the file contents before and after the progress and asks u to save it
or not
If u save it the original file contents will change to the new encrypted form and asks u again in case if u
need to do another think
7|Page
U can also decrypt the data and save it using the same program
And if u enter any incorrect input during the progress it will worn u that u have entered incorrect input
The program works by taking the text data from the file path that u give by
using a reader that explant above and encrypting it by using our specific
algorithm and saving it to the same file
The biggest problem that we have it if you or someone accidently edit the
encrypted that it may be lost and lose the ability to decrypt it
Another problem is that the code written without using the “try” to prevent
program from crashing
8|Page
The encrypting method can be easy to analyses and solving it
Because the limit of time that we have making the program it have a lot to do
with
1. Bug fixing
4. Make the encryption works for more types of files like images and
others
References
No references have been used in this program and all of it build on a personal
Knowledge
*expect the ascii art that been marked by using patorjk.com website*
9|Page
10 | P a g e