Screenshot 2024-05-20 at 5.35.42 PM
Screenshot 2024-05-20 at 5.35.42 PM
Ms.Madhumathi Jessu
(Assistant Professor, Department of Computer science engineering)
MASTER IN TECHNOLOGY
in
This is to Certified that the project report titled “MESSAGE ENCRYPTION AND
DECRYPTION USING PYTHON” is the bonafide work of ZEBA
YASMEEN(1602-23-742-013) int the partial fulfilment of requirements for the
award degree of MASTER OF ENGINEERING IN COMPUTER SCIENCE
ENGINEERING, who carried out the project work under my supervision.
Certified further, that to the best of my knowledge the work reported herein does
not form part of any other thesis or dissertation on basis of which a degree or
award was conferred on an earlier occasion for this or any other candidate.
With great pleasure we want to take this opportunity to express our heartfelt
gratitude to all people who helped in making this project work a great success
I am grateful to the Ms.Madhumati Jessu mam for her valuable suggestions and
gratitude given by her during the execution of this project work
I would like to thank the teaching and non-teaching staff of dept. of. COMPUTER
SCIENCE ENGINEERING for sharing their knowledge with me.
ZEBA YASMEEN
1602-23-742-013
1
INDEX
LIST OF FIGURES i
LIST OF TABLES i
ABSTRACT ii
1.1 INTRODUCTION 01
1.2 HISTORY 02
1.3 OBJECTIVE 02
1.7 MOTIVATION 09
2.1 GENERAL 08
2.2 METHEDOLOGIES 09
3.1 GENERAL 13
3.2 HARDWARE REQUIREMENTS 13
4.1 GENERAL 15
CHAPTER: 5
CHAPTER: 6
6 IMPLEMENTATION 27-32
CHAPTER 7
7 SNAPSHOTS 33-38
CHAPTER : 8
CHAPTER: 9
9 APPLICATION 40
9.2 ADVANTAGES 41
9.3 DISAVANTAGES 41
CHAPTER: 10
10 CONCLUSIONS 42-44
10.2 REFERENCES 44
LIST OF FIGURES
FIGURE NO. FIGURE NAME PAGE NO.
LIST OF TABLES
i
ABSTRACT:
ii
CHAPTER 1
1
CHAPTER 1
INTRODUCTION
1.1 INTRODUCTION
CRYPTOGRAPHY
2
Symmetric / Secret Key Cryptography
The technique of Secret key encryption can also be known as the symmetric-
key, shared key, single-key, and eventually private-key encryption.The
technique of private key uses for all sides encryption and decryption of secret
data. The original information or plaintext is encrypted with a key by the sender
side also the similarly key is used by the receiver to decrypt a message to obtain
the plaintext. The key will be known only by a people who are authorized to the
encryption/decryption.However, the technique affords the good security for
transmission but there is a difficulty with the distribution of the key. If one stole
or explore the key he can get whole data without any difficulty.
We can call this technique as asymmetric cryptosystem or public key cryptosystem, this
technique use two keys which are mathematically associated, use separately for
encrypting and decrypting the information. In this technique,when we use the private
key, there are no possibilities to obtain the data or simply discover the other key. The
key used for encryption is stored public therefore it’s called public key, and the
decryption key is stored secret and called private key.
Steganography
It can be defined as the science of hiding and communicating data through apparently
reliable carriers in attempt to hide the existence of the data. So, there is no knowledge
of the existence of the message in the first place.
If a person views the cover which the information is hidden inside, he or she will have
no clue that there is any covering data, in this way the individual won’t endeavour to
decode the data.
3
The secret information can be inserted into the cover media by the stego system encoder
with using certain algorithm. A secret message can be plaintext, an image, ciphertext,
or anything which can be represented in form of a bitstream.
After the secret data is embedded in the cover object, the cover object will be called as
a stego object also the stego object sends to the receiver by selecting the suitable
channel, where decoder system is used with the same stego method for obtaining
original information as the sender would like to transfer.
1.2 HISTORY
In the early 1970s: IBM formed a 'crypto group,' which designed a block cypher to
protect its customers' data. In 1973, the US adopted it as a national standard - the Data
Encryption Standard, or DES. It remained in use until it cracked in 1997.
1.3 OBJECTIVE
CONFIDENTIALITY:-Confidentiality of data is enforced by using encryption.
Encryption algorithms can be symmetric – here sender and recipient of a message
need the same key – or asymmetric – sender and recipient use different keys.
INTEGRITY:-data integrity ensures full confidence that the data you are receiving
is the actual valid data from the sender, and has not been tampered with or
manipulated.
NON-REPUDIATION:-Assurance that the sender of information is provided with
proof of delivery and the recipient is provided with proof of the sender's identity, so
neither can later deny having processed the information.
AUTHENTICATION:- Cryptographic authentication identifies a user by proof of
possession of the private key component of a cryptographic credential.
4
There are many algorithms for encryption decryption process like AES, DES, RSA in
which encryption is done with the help of substitutions and transformations on the
plaintext. It uses prime numbers for encryption process.
B. Cryptography using Public Key (PKC): Two different keys are used in this. One
key is used for encryption and another for decryption. It includes Rivest, Shamir,
Adleman (RSA) algorithm.
5
1.6 PROPOSED SYSTEM
There will be an agreement between the sender and the receiver about the
key for the concealment algorithm as well as the key for the encryption
algorithm or these keys may be exchanged by a secure communication
method.Our method starts by encryption first then hide encrypted data.
1.7 Motivation
Cryptography, the practice of securing communication and information, is
driven by several key motivations. These motivations arise from the need
to protect sensitive data, ensure privacy, and establish trust in various
aspects of our modern digital world. Here are some of the primary
motivations for cryptography:
6
2. Data Integrity: Cryptographic techniques are employed to ensure the
integrity of data, meaning that it remains unaltered during transmission or
storage. By using techniques such as digital signatures and message
authentication codes, cryptography can detect any unauthorized
modifications or tampering with the data.
7
as credit card details, remains confidential and protected from interception
or misuse.
8
CHAPTER 2
9
CHAPTER 2
PROJECT DESCRIPTION
2.1 GENERAL
Cryptography is a field that deals with the science and art of securing communication
and information through the use of mathematical algorithms and techniques. It involves
the study, development, and application of various cryptographic algorithms, protocols,
and systems to protect data confidentiality, integrity, authentication, and non-
repudiation.
2.2 METHODOLOGIES
Identify the encryption and decryption requirements: Determine the specific needs
for message encryption and decryption, such as the level of security required, key
management, and compatibility with existing systems.
Select appropriate encryption algorithms: Choose suitable encryption algorithms
based on factors like security, performance, and key length. Consider both
symmetric and asymmetric encryption algorithms.
Determine key management procedures: Establish protocols for generating,
distributing, and storing encryption keys securely. Key management is crucial for
maintaining the confidentiality of encrypted messages.
Implement encryption and decryption modules: Develop software or hardware
modules to perform encryption and decryption operations. These modules should
be efficient, secure, and compatible with the target system.
10
Integrate encryption and decryption modules: Integrate the encryption and
decryption modules into the existing messaging system or application. Ensure
proper data flow and compatibility with other system components.
Test and validate the implementation: Conduct rigorous testing to verify the
correctness and effectiveness of the encryption and decryption techniques. Test
against known attacks and evaluate performance metrics.
Deploy and monitor the system: Once the encryption and decryption modules are
successfully implemented, deploy the system in the intended environment. Monitor
the system for any vulnerabilities, updates, or emerging threats.
DES is a block cipher and encrypts data in blocks of size of 64 bits each, which
means 64 bits of plain text go as the input to DES, which produces 64 bits of
ciphertext.
The same algorithm and key are used for encryption and decryption, with minor
differences.
AES is widely used today as it is a much stronger than DES and triple DES despite
being harder to implement.
11
RSA:-Rivest-Shamir-Adleman
RSA algorithm is an asymmetric cryptography algorithm. Asymmetric actually means
that it works on two different keys i.e. Public Key and Private Key.
As the name describes that the Public Key is given to everyone and the Private key is
kept private. client (for example browser) sends its public key to the server and
requests some data.
The server encrypts the data using the client’s public key and sends the encrypted data.
DIFFIEHELLMAN
Diffie-Hellman key exchange is a method of digital encryption that securely exchanges
cryptographic keys between two parties over a public channel without their
conversation being transmitted over the internet.
The two parties use symmetric cryptography to encrypt and decrypt their messages.
Each of the functions can act on input data (called a “message”) of variable length to
produce an output value of a specified length.
12
Cryptography is the science of securing information by converting it into a form that
is unintelligible to unauthorized individuals.
The Diffie-Hellman Key Exchange protocol allows two parties to securely establish a
shared secret key over an insecure communication channel.
Elliptic Curve Cryptography (ECC) offers strong security with shorter key lengths,
making it efficient for resource-constrained environments like mobile devices.
Hash functions such as SHA-256 and MD5 are used to ensure data integrity and create
unique message digests.
Digital signatures use asymmetric key algorithms to provide authenticity and integrity
for digital documents, enabling verification of the sender's identity.
Transport Layer Security (TLS) and Secure Sockets Layer (SSL) are widely used
cryptographic protocols for securing internet communications, including web browsing
and email.
13
3. Attribute-based encryption (ABE) is a proposed system where access to encrypted
data is granted based on specific attributes or conditions, enhancing fine-grained access
control and data security.
4. Zero-knowledge proofs with enhanced functionalities, such as non-interactive zero-
knowledge proofs and succinct zero-knowledge proofs, are proposed to provide
stronger privacy guarantees and efficient verification in various applications.
5. Multi-party computation (MPC) protocols are proposed cryptographic systems that
enable secure collaborative computations among multiple parties without revealing
their inputs, ensuring privacy and trust in distributed environments.
14
CHAPTER 3
15
CHAPTER 3
REQUIREMENTS ENGINEERING
3.1 GENERAL
In a country like India, accident is a major problem which must be solved using new
technologies rather than traditional ways.
Indian commuters travel approximately 35 km/day, out of that 75% commute using private
vehicles. If the average speed is around 60 km/h then every person spends 30 minutes per
day travelling. One crore people travel per day so people spend approximately 570 years
in driving per day. This is too much time spent on just driving.
77.3% accidents caused because of Human error (2018). One-fourth of the Indian drivers
use phones while driving which is dangerous for everybody (survey 2015).
Processor - Intel
Speed - 1.1 GHz
Ram - Minimum of 256 MB or
higher
Hard Disk - 10 GB or higher
Key Board - Standard 110 keys Keyboard
Mouse - Two or Three Button Mouse
Monitor - 15” or 17” color monitor
3.3 SOFTWARE REQUIREMENTS
Operating System - Windows 11
19
CHAPTER 4
20
CHAPTER 4
DESIGN ENGINEERING
4.1 GENERAL
Design Engineering deals with the various UML [Unified Modelling language]
diagrams for the implementation of project. Design is a meaningful engineering
representation of a thing that is to be built. Software design is a process through
which the requirements are translated into representation of the software. Design
is the place where quality is rendered in software engineering. Design is the
means to accurately translate customer requirements into finished product.
4.2 UML DIAGRAMS
EXPLANATION:
A use case diagram can identify the different types of users of a system and
the different use cases and will often be accompanied by other types of
diagrams as well. The use cases are represented by either circles or ellipses.
36
4.2.2 CLASS DIAGRAM
EXPLANATION
37
4.2.3 SEQUENCE DIAGRAM
EXPLANATION:
A sequence diagram shows object interactions arranged in time sequence.
It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of
the scenario.
Sequence diagrams are typically associated with use case realizations in the
Logical View of the system under development.
Sequence diagrams are sometimes called event diagrams or event scenarios.
38
4.2.5 ACTIVITY DIAGRAM
EXPLANATION:
Activity diagrams are graphical representations of workflows of stepwise
activities and actions with support for choice, iteration and concurrency.
In the Unified Modeling Language, activity diagrams are intended to model both
computational and organizational processes (i.e., workflows) as well as the data
flows intersecting with the related activities.
Although activity diagrams primarily show the overall flow of control, they
can also include elements showing the flow of data between activities through
one or more data stores.
.
39
4.3 SYSTEM ARCHITECTURE
Users/Clients: These are the entities or individuals who interact with the
cryptographic system, such as sending or receiving encrypted data, generating
keys, or performing cryptographic operations.
40
Key Management: This component is responsible for generating, storing, and
distributing cryptographic keys. It includes functionalities like key generation,
key storage, key exchange, and key revocation.
Audit/Logging: This component records and logs various activities within the
cryptographic system, including key generation, key usage,
encryption/decryption operations, and user activities. It enables monitoring,
auditing, and forensic analysis for security and compliance purposes.
41
CHAPTER 5
42
CHAPTER 5
DEVELOPMENT TOOLS
Python
Python is a high-level, interpreted, interactive and object-oriented scripting language.
Python is designed to be highly readable. It uses English keywords frequently where as
other languages use punctuation, and it has fewer syntactical constructions than other
languages. History of Python
Python was developed by Guido van Rossum in the late eighties and early nineties at the
National Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++,
Algol68, Small Talk, and UNIX shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).
Python is now maintained by a core development team at the institute, although Guido van
Rossum still holds a vital role in directing its progress.
Importance of Python
Features of Python
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly.
43
Easy-to-read − Python code is more clearly defined and visible to the eyes.
A broad standard library − Python's bulk of the library is very portable and cross
platform compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.
Extendable − you can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.
Databases − Python provides interfaces to all major commercial databases.
GUI Programming − Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh,
and the X Window system of Unix.
Scalable − Python provides a better structure and support for large programs than shell
scripting.
Apart from the above-mentioned features, Python has a big list of good features, few are
listed below –
It can be used as a scripting language or can be compiled to byte-code for building large
applications.
It provides very high-level dynamic data types and supports dynamic type checking.
It supports automatic garbage collection.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
44
• MATPLOTLIB - 2D plotting library producing publication quality figures.
• SCIKIT-LEARN - the machine learning algorithms used for data analysis and data
mining tasks.
45
CHAPTER 6
46
CHAPTER 6
IMPLEMENTATION
6.1 CODING:
import base64
#Encoding Function
enc = []
for i in range(len(msg)):
list_enc = chr((ord(msg[i]) +
ord(list_key)) % 256)
enc.append(list_enc)
return base64.urlsafe_b64encode("".join(enc).encode()).decode()
#Decoding Function
dec = []
47
enc = base64.urlsafe_b64decode(code).decode()
for i in range(len(enc)):
dec.append(list_dec)
return "".join(dec)
def Result():
msg = Message.get()
k= key.get()
i = mode.get()
if (i==1):
Output.set(encode(k, msg))
elif(i==2):
Output.set(decode(k, msg))
else:
def Reset():
Message.set("")
48
key.set("")
mode.set(0)
Output.set("")
wn = Tk()
wn.geometry("500x500")
wn.configure(bg='azure2')
Message = StringVar()
key = StringVar()
mode = IntVar()
Output = StringVar()
headingFrame1 = Frame(wn,bg="gray91",bd=5)
headingFrame1.place(relx=0.2,rely=0.1,relwidth=0.7,relheight=0.16)
49
label1 = Label(wn, text='Enter the Message', font=('Courier',10))
label1.place(x=10,y=150)
msg.place(x=200,y=150)
label2.place(x=10,y=200)
InpKey.place(x=200,y=200)
label3.place(x=10,y=250)
label3.place(x=10,y=350)
res.place(x=200,y=350)
50
ShowBtn = Button(wn,text="Show Message",bg='yellow',
fg='black',width=15,height=1,command=Result)
ShowBtn.place(x=180,y=400)
ResetBtn.place(x=15,y=400)
QuitBtn.place(x=345,y=400)
wn.mainloop()
51
CHAPTER 7
52
CHAPTER 7
SNAPSHOTS
7.1 SNAPSHOTS
53
OUTPUT FOR MESSAGE CRYPTOGRAPHY
54
ENCRYPTION USING KEY
IMAGE STEGANOGRAPHY
55
IMAGE HIDING USING STEGANOGRAPHY
56
CHAPTER 8
57
CHAPTER 8
SOFTWARE TESTING
Software testing plays a crucial role in ensuring the security and reliability of
cryptographic systems. Here are some common software testing techniques used in
cryptography:
Functional Testing: This type of testing focuses on verifying that the cryptographic
algorithms and operations are functioning correctly according to the specifications. It
involves testing encryption, decryption, key generation, key exchange, and other
cryptographic operations to ensure they produce the expected results.
Fuzz Testing: Fuzz testing, or fuzzing, is a technique where the system is tested by feeding
it with invalid, unexpected, or random inputs to identify potential bugs or vulnerabilities.
Fuzz testing can help uncover implementation flaws or weaknesses in cryptographic
libraries or protocols.
58
Compatibility Testing: Compatibility testing ensures that the cryptographic system can
interact and function correctly with different platforms, operating systems, libraries, and
network protocols. It involves testing interoperability, data exchange, and compatibility
with various hardware and software configurations.
Usability Testing: Usability testing focuses on assessing the user-friendliness and ease of
use of the cryptographic system. It involves evaluating the system's user interface, user
documentation, error handling, and feedback mechanisms to ensure that users can interact
with the system effectively and securely.
Code Review and Static Analysis: These techniques involve reviewing the source code
of the cryptographic system for potential vulnerabilities, logic errors, or coding mistakes.
Static analysis tools can help identify common coding issues and security flaws without
executing the code.
Cryptographic Protocol Analysis: This type of testing focuses on analyzing the security
properties of cryptographic protocols, such as key exchange or authentication protocols. It
involves formal methods, model checking, or symbolic analysis to verify the protocol's
security properties and identify potential vulnerabilities.
59
CHAPTER 9
60
CHAPTER 9
APPLICATION
The interaction procedure of user and the web application can be further more
improved to make it interactive and user friendly .
The web page layout may be improved .we are trying to upgrade it into a file storage
site as well as a file sharing site so that more users can be attracted.
We think more flexibility and interactive features can make it more bigger.
60
ADVANTAGES:
DISADVANTAGES:
5. Compatibility: Encrypted messages may not be compatible with all devices and
applications, requiring additional software or configuration to decrypt and access the
message.
61
CHAPTER 10
62
CHAPTER -10
CONCLUSION
10.1 CONCLUSION
REFERNCES
10.2 REFERNCES
63
[1] Surbhi Singla, Anju Bala, Cryptography and Steganography Algorithm for Cloud
Computing
https://www.semanticscholar.org/paper/A-Review%3A-Cryptography-and-
Steganography-Algorithm-Singla-
Bala/dc1b0833cada439c33a873aef472c560961d2833/figure/2
[2] Aya Y. AlKhamese, Wafaa R. Shabana, Ibrahim M. Hanafy, Data Security in Cloud
Computing Using Steganography
https://www.semanticscholar.org/paper/Data-Security-in-Cloud-Computing-Using-A-
Review-AlKhamese-Shabana/2fda9f290f571c71ac218e833b990738585c4ee9
[5] Aayushi Ajmera, Shiraz Saptarshi Ghosh, T Vijayetha, Secure LSB Steganography
over Modified Vigenère-AES Cipher and Modified Interrupt Key-AES Cipher
64