Farman Internship Project Report On Python
Farman Internship Project Report On Python
on
certificate of
PYTHON PROGRAMMING
SUBMITTED TO:
Mr. Mayur Dev Sewak
General Manager, Operations
Eisystems Services
Ms. Mallika Srivastava
Trainer, Data Science & Analytics Domain
Eisystems Services
SUBMITTED BY:
Mohd Farman
1
index
1 Cover Page
1
2 Acknowledge 3
3 Python 4
5 Abstract 9
6 Objective 10
7 Details of process 11
8 System requirement 18
10 The Ou 23
11 Summary 24
12 References 25
2
ACKNOWLEDGE
I would like to acknowledge the contributions of the following people without whose help
and guidance this report would not have been completed. I acknowledge the counsel and
support of our training coordinator, Ms. Mallika Srivastava Trainer, Data Science & Analytics
Domain Eisystems Services with respect and gratitude, whose expertise, guidance, support,
encouragement, and enthusiasm has made this report possible. Their feedback vastly
improved the quality of this report and provided an enthralling experience. I am indeed
proud and fortunate to be supported by her.
This acknowledgement will remain incomplete if I fail to express our deep sense of
obligation to my parents and God for their consistent blessings and encouragement.
3
Introduction
Python is a widely used general-purpose, high level programming language. It was initially
designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It
was mainly developed for an emphasis on code readability, and its syntax allows
programmers to express concepts in fewer lines of code. Python is dynamically typed and
garbage-collected. It supports multiple programming paradigms, including procedural,
object-oriented, and functional programming. Python is often described as a "batteries
included" language due to its comprehensive standard library.
Features
• Interpreted
In Python there is no separate compilation and execution steps like C/C++. It directly run
the program from the source code. Internally, Python converts the source code into an
intermediate form called bytecodes which is then translated into native language of specific
computer to run it.
• Platform Independent
Python programs can be developed and executed on the multiple operating system
platform. Python can be used on Linux, Windows, Macintosh, Solaris and many more.
• Multi- Paradigm
• Simple
Python is a very simple language. It is a very easy to learn as it is closer to English language.
In python more emphasis is on the solution to the problem rather than the syntax.
Python standard library is very vast. It can help to do various things involving regular
expressions, documentation generation, unit testing, threading, databases, web browsers,
CGI, email, XML, HTML, WAV files, cryptography, GUI and many more.
4
Firstly, Python is freely available. Secondly, it is open-source. This means that its source
code is available to the public. We can download it, change it, use it, and distribute it. This is
called FLOSS (Free/Libre and OpenSource Software). As the Python community, we’re all
Encryption is the act of encoding a message so that only the intended users can see it. We
encrypt data because we don’t want anyone to see or access it.
We will use the cryptography library to encrypt a file. The cryptography library uses a
symmetric algorithm to encrypt the file. In the symmetric algorithm, we use the same key to
encrypt and decrypt the file. The fernet module of the cryptography package has inbuilt
functions for the generation of the key, encryption of plain text into cipher text, and
decryption of cipher text into plain text using the encrypt() and decrypt() methods
respectively. The fernet module guarantees that data encrypted using it cannot be further
manipulated or read without the key.
Encryption
It is nothing but a simple process in which we convert our data or information into secret
code to prevent it from unauthorized access and keep it private and secure.
First, we will select an image, and then we will convert that image into a byte array due to
which the image data will be totally converted into numeric form, and then we can easily
apply the XOR operation to it. Now, whenever we will apply the XOR function on each value
of the byte array then the data will be changed due to which we will be unable to access it.
But we should remember one thing here our encryption key plays a very important role
without that key we can not decrypt our image. It acts as a password to decrypt it.
The below program depicts the basic approach to encryption:
# Assign values
data = 1281
key = 27
# Display values
print('Original Data:', data)
print('Key:', key)
5
# Encryption
data = data ^ key
# Decryption
data = data ^ key
print('After Decryption:', data)
Output:
Decryption
It is nothing but a process of converting our encrypted data into a readable form. Here
we will again apply the same XOR operation on an encrypted image to decrypt it. But always
remember that our encryption key and decryption key must be the same.
Executable Code for Decryption:
# print path of image file and decryption key that we are using
6
print('The path of file : ', path)
print('Note : Encryption key and Decryption key must be same.')
# converting image into byte array to perform decryption easily on numeric data
image = bytearray(image)
except Exception:
print('Error caught : ', Exception.__name__)
7
Output:
8
Abstract
In this project we have created a Python programming Project named “Message and Image
Encryption and Decryption”. An Image Encryption Decryption is an image processing
application created in python with tkinter gui and OpenCv library.
In this application user can select an image and can encrypt that image to gray scale image
and can even decrpyt also.
The purpose of encryption is confidentiality concealing the content of the message by
translating it into a code.
Also after encrypting and decrypting user can also save the edited image anywhere in the
local system.
Also there is option to reset to the original image.
9
Objectives
The main objective of our project is to provide security of the message and image-based
data with the help of suitable key and protect the message and image from illegal copying
and distribution
10
Detail of process
Introduction
In this digital era, the need for security is increasing rapidly. Complying with this requirement,
the encryption & decryption algorithms were devised.
Now, we will build a project that can encode and decode a message. Let’s start by getting to
know more about this project.
To build this project, the developer needs to have good knowledge of the Tkinter module and
Python. It is also advised to have some idea on encryption & decryption.
11
3. Writing function for encryption
4. Writing function for decryption
The Tkinter module needs to be installed. You can install this module by using the following
command.
12
Code Explanation:
a. ord(): This function gives the corresponding ASCII values of a given character.
b. chr(): This function gives the corresponding character to the given ASCII value.
c. append(): Adds the elements to the end of the list
d. ord(msg[i]) + ord(list_key)) % 256 : This gives the remainder of division of addition of
ord(message[i]) and ord( key_c) with 256 and passes that remainder to chr() function
e. base64.urlsafe_b64encode(): This helps in encoding the string using url and file system safe
alphabets into the binary form.
Code Explanation:
a. base64.urlsafe_b64decode(): This helps in decoding the binary string using url and file
system safe alphabets into the normal form of strings.
b. ord(): This function gives the corresponding ASCII values of a given character
c. chr(): This function gives the corresponding character to the given ASCII value
d. 256 + ord(message[i]) – ord(key_c)) % 256 : This gives the remainder of addition of 256 with
subtraction of ord(message[i]) – ord( key_c) and then division with 256 and passes that
remainder to chr() function
13
5. Creating the window
Code Explanation:
a. geometry(): It sets the length and width of the project window.
b. configure(): It sets the background color of the screen
c. title(): It displays the title on the top of the python message encryption-decryption project
window.
14
Code Explanation:
a. The message and key hold the values in the entries that hold the input message key. And
mode checks which radio button is pressed for encryption/decryption. Output values hold the
value shown in the Result entry after doing the operation.
b. Frame(): It creates a rectangular object that holds various widgets on the screen
c. place(): This is used to place the widgets in a specified location based on coordinates or
relative to the parent component
d. Label(): This creates a label that can be used to show information
e. Entry(): This widget is used to take input from the user
f. Radiobutton(): These help in choosing one of the given options
15
7. Adding the buttons and their functions
Code Explanation:
a. The result() function
i. it takes the message, key, and the mode that are inputted by the user
ii. Then based on the mode, calls one of the encryption() or decryption() functions
iii. Shows the output in the Result field
iv. If no mode is selected, shows the message to select one of the either
16
b. Button(): This creates a button with mentioned color, text, etc. and the command
parameter represents the function that is to be executed on clicking the button
c. place(): This is used to place the widgets in a specified location based on coordinates or
relative to the parent component
d. mainloop(): This makes sure the screen runs in a loop till it is manually closed by the user
17
System Requirement
For user:
Browsers:
Google Chrome (recommended), Internet Explorer, Mozilla Firefox, Safari, Micro-softedge,
Opera, Vivaldi, etc.
Gamil account
High Speed Internet Connection
For Developers:
Operating system:
-Windows: XP/Vista/7/8/8.1/10 or late
–OSX: Snow leopard 10.6.3 or later Ubuntu, Debian, Fedora, Cent OS or Suse Linux
18
Data Flow Diagram
19
Input/output
20
21
The Output of Python Message Encryption Decryption Project
Fig1. The image of output of python encryption
22
Fig2. The image of output of python decryption
It can be observed that when the output of encryption of mohd farman is given as input to
decryption, the output is mohd farman.
23
Summary
In this project, we successfully built the python message encryption decryption system using
the Tkinter and base4 modules.
24
References
https://www.youtube.com/
https://www.javatpoint.com/
https://youtu.be/rxkGItX5gGE
https://projectgurukul.org/python-message-encryption-decryption-project/
https://www.greekforgreek.com/
25