QWERT
QWERT
GAYATHRI S (727722EUCS050)
HAASHINI A (727722EUCS060)
GURURAGAVENDRA PS (727723EUCS501)
HEMANTH SURYA AS (727723EUCS503)
of
BACHELOR OF ENGINEERING
IN
An Autonomous Institution | Approved by AICTE | Affiliated to Anna University | Accredited by NAAC with A++ Grade
Kuniyamuthur, Coimbatore – 641008.
November 2024
II
SUSTAINABLE DEVELOPMENT GOALS
The Sustainable Development Goals are a collection of 17 global goals designed to the
blue print to achieve a better and more sustainable future for all. The SDGs, set in 2015
by the United Nations General Assembly and intended to be achieved by the year 2030
In 2015, 195 nations agreed as a blueprint that they can change the world for the better.
The project is based on one of the 17 goals.
II
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
Dr. GRANTY REGINA ELWIN J Ms SUDHA K
HEAD OF THE DEPARTMENT SUPERVISOR
Professor Assistant Professor
Computer Science and Engineering Computer Science and Engineering
Sri Krishna College of Engineering and Sri Krishna College of Engineering
Technology and Technology
Kuniyamuthur, Coimbatore–641008. Kuniyamuthur, Coimbatore–641008.
III
ABSTRACT
This project implements a graphical application for image encryption and decryption
with cryptographic key generation, utilizing Python's tkinter GUI library and OpenCV
for image processing. The application allows users to select an image, generate a random
cryptographic key, and perform encryption and decryption on the selected image. The
encryption is based on dividing the normalized grayscale pixel values of the image by a
Gaussian noise-based key matrix, ensuring secure pixel-wise encryption . The
decryption reverses this process by multiplying the encrypted image with the stored key,
restoring the original pixel values. Additionally, the application provides the ability to
generate QR codes of the file path, facilitating easy data sharing. This project
demonstrates the fundamental principles of image-based encryption and decryption
using matrix manipulation, providing a practical, user-friendly interface for
cryptographic learning and application. Furthermore, the application integrates a QR
code generation feature, allowing users to create QR codes of the image file path. This
feature facilitates secure and efficient data sharing, making it convenient to share
encrypted files or cryptographic keys through QR scanning.Overall, this project
demonstrates the fundamental principles of image-based cryptography, combining matrix
manipulation, noise-based key generation, and QR code functionality. It serves as a
practical and user-friendly tool for cryptographic education and application, offering
valuable insights into the integration of data science, privacy enhancement, and secure
image processing.The encryption mechanism leverages matrix manipulation techniques
by dividing the normalized grayscale pixel values of the image by the Gaussian noise-
based key matrix. This method ensures secure pixel-wise encryption, making the image
data incomprehensible without the correct cryptographic key. For decryption, the
application reverses the encryption process by multiplying the encrypted image with the
stored key matrix, accurately restoring the original pixel values and reconstructing the
image .
IV
TABLE OF CONTENTS
ABSTRACT iv
LIST OF TABLES vii
LIST OF FIGURES viii
LIST OF ABBREVIATIONS ix
1. INTRODUCTION
1.1 Overview 1
1.2 Components Of System 2
1.3 Advanced Technologies 4
1.4 Global Perspectives 6
2. SYSTEM ANALYSIS
2.1 Existing System 8
2.2 Drawbacks 9
2.3 Problem Definition 9
2.4 Proposed System 11
2.5 Advantages 11
3. SYSTEM REQUIREMENTS
3.1 Software Requirements 12
3.2 Software Description 13
3.3 Summary 13
4. SYSTEM DESIGN
4.1 Module Description 14
4.2 Key Management 15
4.3 Encryption/Decryption 15
4.4 Audit And Logging 16
4.5 User Management 17
V
4.6 Use Case Management 17
4.7 Sequence Diagram 18
4.8 Dataflow Diagram 20
5. SYSTEM TESTING
5.1 Unit Testing 21
5.2 Integration Testing 21
5.3 Security And Authentication 22
6. CONCLUSION 23
APPENDICES
Appendix 1 – Source Code 24
Appendix 2 – Screenshots 26
REFERENCE 28
VI
LIST OF TABLES
VII
LIST OF FIGURES
VIII
LIST OF ABBREVIATIONS
IX
CHAPTER 1
INTRODUCTION
1.1 OVERVIEW
Key generation is a central aspect of this project, as the security of the encryption
process relies heavily on the strength and randomness of the keys. In this application,
the cryptographic key is dynamically generated for each encryption session, making it
highly secure and unique. The encrypted image is stored and displayed in the GUI,
allowing users to visualize the transformation from the original image to the encrypted
version and back to the decrypted form. By implementing these methods, the project
demonstrates how cryptographic techniques can be applied to image files, ensuring
confidentiality .
Additionally, the project incorporates a QR code generation feature that encodes the
image file path into a scannable format. This functionality adds another layer of data
handling, allowing the user to store or share image information securely. The project
combines the fundamentals of cryptography with practical applications like image
processing and QR code generation, offering a comprehensive exploration of modern
encryption techniques in visual data protection.
1
1.2 COMPONENTS OF SYSTEM
The Graphical User Interface (GUI) of this application is designed using Python's
Tkinter library, a popular tool for creating GUI applications. Tkinter provides an easy-
to-use interface for building the layout, buttons, and labels, making it ideal for handling
user interactions in this image encryption and decryption tool. The main window of the
application is titled "Image Encryption & Decryption" and has a calming light blue
background color (#F0F8FF), setting a visually pleasing environment for users. This
main window acts as a container for various user interface elements, including buttons
and labels, as well as for displaying the selected, encrypted, decrypted, and QR code
images .
The application features multiple buttons, each linked to specific functions that manage
different tasks. For instance, users can choose an image with the "Choose Image" button,
encrypt it with the "Encrypt" button, and decrypt it with the "Decrypt" button. Additional
buttons include options for generating a QR code of the encrypted image, resetting the
image to its original state, and exiting the application. Each button triggers a
corresponding function that performs these specific actions, ensuring that the GUI is
both interactive and functional.
This application’s image processing and encryption rely on Python's Open-CV (cv2)
library, which offers powerful tools for handling and manipulating images. Open-CV
plays a key role in reading and preparing images for encryption, including tasks like
loading the image (using cv2.imread()), resizing it to fit the interface, and converting it
to grayscale. Grayscale conversion is essential as it simplifies the data structure of the
image, making it easier to perform pixel-based encryption and decryption. Additionally,
OpenCV helps in normalizing the pixel values of the image, which scales the data to a
range suitable for mathematical operations involved in encryption.
2
The qrcode library is used to generate a scannable QR code that represents the file path
of the selected image. This QR code provides an easy way to share the image or its
encrypted version without exposing the image data directly. When the user selects an
image, the file path is encoded into the QR code, allowing recipients to scan and access
the file’s location. This QR code is generated and displayed in the GUI, offering a
convenient sharing method while keeping the image secure. The Pillow (PIL) library is
used in tandem with this functionality to open, resize, and display the QR code image
within the application interface. Additionally, PIL handles the display of encrypted and
decrypted images, ensuring they appear at an appropriate resolution within the GUI after
processing.
For file handling, the application utilizes Tkinter’s filedialog module, which enables
users to open a dialog box and select an image for encryption or decryption. This
interaction provides a seamless way to retrieve the image file path, which is then used
to load the image into the system. Once the image is encrypted, it is saved locally as a
.jpg file (image_encrypted.jpg), ensuring that users have a persistent copy of the
encrypted image on disk. Similarly, the decrypted version of the image is saved as
image_output.jpg, allowing the user to easily retrieve and restore the original content.
The security of this application is reinforced by the Encryption Key and the QR
Code feature. A cryptographic key is generated for each encryption instance using
a random distribution method (np.random.normal()) from the Numpy library.
The application includes thoughtful user interaction features, providing clear feedback
to guide the user through the encryption and decryption processes. Message boxes are a
key component for communicating with the user and are implemented using Tkinter's
mbox functions, such as mbox.showinfo(), mbox.showwarning(), and
mbox.showerror(). These message boxes notify users of various outcomes and necessary
actions.
3
To enhance the user experience and ensure a smooth application closure, the Exit button
allows the user to safely exit the application. When this button (labeled exit_btn) is
clicked, a confirmation prompt appears to verify that the user truly wants to close the
program. This confirmation step prevents accidental closures and allows users to save
their work or complete any last actions.
Cryptographic Key Generation: The project uses random number generation techniques
to create a cryptographic key that encrypts and decrypts images. Specifically, the project
leverages the Gaussian (Normal) distribution (np.random.normal()) to generate a key
that is unique for each image. This ensures that even if two images are identical, their
encrypted versions will be different due to unique encryption keys. Such techniques
form the foundation of secure communication and data protection in modern
cryptography.
The image is normalized and encrypted by dividing pixel values by the cryptographic
key, which ensures that the original image is scrambled and cannot be easily restored
without the key. This simple but effective encryption method can be extended to more
complex cryptographic systems, such as AES (Advanced Encryption Standard) or RSA,
for stronger security.
The OpenCV (Open Source Computer Vision) library plays a vital role in real-time
image processing for this project, offering tools for efficient and effective manipulation.
OpenCV enables key operations such as converting images to grayscale, normalizing
pixel values to a scale between 0 and 1 for cryptographic readiness, and reading and
saving images in various formats. Resizing and displaying images are also essential for
presenting images clearly within the GUI, ensuring that encryption and decryption
processes maintain the visual integrity of the image.
4
QR code technology is integrated into this project to facilitate secure and efficient
sharing of encrypted images. Using the qrcode library, the system generates QR codes
that encode the file path of the encrypted image rather than the image data itself. This
method enhances security by ensuring that only the file path is shared, minimizing the
risk of exposing sensitive image data during the transfer process. Additionally, QR codes
offer convenience, allowing users to easily scan and access the image or its encrypted
version from their mobile devices or other systems. This makes the sharing of images
faster, more accessible, and more secure, as users can retrieve encrypted content without
the need for direct data transmission.
In this project, the Graphical User Interface (GUI) is built using Tkinter, an advanced
toolkit ideal for creating cross-platform desktop applications. Tkinter is utilized for
designing interactive elements such as buttons, labels, and input forms, which facilitate
user interactions like selecting images, triggering encryption or decryption, and
generating QR codes.
The system’s intuitive interface, enabled by Tkinter, ensures that both technical and non-
technical users can operate it with ease. It also plays a crucial role in displaying results,
such as encrypted or decrypted images and QR codes. Additionally, the Pillow (PIL)
library, a powerful image processing library, is used to manage and manipulate images
within the GUI.
5
1.4 GLOBAL PERSPECTIVES
Remote Work and Digital Communication: The rise of remote work , online
collaboration tools , and digital communication channels has led to an increased reliance
on secure data transfer systems. In this globalized era, people from different parts of the
world work and communicate digitally. The ability to securely encrypt, decrypt, and
share information (in the form of images or documents) is critical to ensuring that
sensitive data remains protected, even when transmitted over the internet.
Secure Data Sharing Across Borders: With globalization, businesses and individuals
frequently need to exchange data across national borders. This project addresses the need
for secure file sharing through encrypted images and QR codes, ensuring that data can
be shared with confidence, even between different jurisdictions.
Ease of Use: This project is designed to be accessible to users with varying levels of
technical knowledge. By incorporating user-friendly GUI frameworks (like Tkinter), the
system is intuitive and easy to navigate. This makes it accessible to a global audience,
from non-technical users who need secure image sharing for personal purposes, to
professionals and businesses that require higher levels of data protection.
6
International Applicability: The use of QR codes is especially useful on a global scale,
as they are widely recognized and compatible across multiple devices and platforms
(smartphones, tablets, etc.). This ensures the project’s functionality extends beyond
geographical boundaries and can be used by people from different cultures, regions, and
industries.
Cloud Computing for Global Scale: Cloud technology is increasingly being used
globally to scale applications, increase storage capacity, and ensure access to services at
any time from any place. By incorporating cloud-based storage and encryption
management, the project could be further developed to support global access and
scalability. This would enable users to securely store and access encrypted images, as
well as generate and scan QR codes through the cloud, providing global access and
eliminating geographical barriers.
As the world increasingly relies on distributed systems, the potential for integrating
blockchain technology becomes apparent. Blockchain can ensure that encrypted data is
securely stored and managed without reliance on centralized servers, which aligns with
the principles of data sovereignty and decentralization that are becoming more
important in global discussions about privacy and security
7
CHAPTER - 2
SYSTEM ANALYSIS
In the current landscape of image encryption and decryption systems, various techniques
are utilized to protect image data from unauthorized access. Traditional methods often
involve simple password-based protection or basic encryption algorithms like the XOR
cipher. Additionally, some systems employ symmetric encryption techniques such as
AES (Advanced Encryption Standard) or DES (Data Encryption Standard), where the
same key is used for both encryption and decryption.
The use of QR codes in image security systems is another emerging feature, as QR codes
can store information related to image paths or encryption details. However, most
existing systems treat QR code generation as a standalone feature rather than integrating
it within the encryption and decryption workflow. Moreover, while there are systems
that allow for basic image encryption, the process often requires complex configurations
or specialized knowledge to implement effectively, which can make them less user-
friendly.
Many current systems use static keys for encryption, which can be easily compromised
if intercepted. Once the key is known, attackers can decrypt any data encrypted with that
key, leading to a potential security breach. There is often no mechanism to generate
dynamic keys for each session, which would provide a higher level of security. Existing
systems often offer limited flexibility when it comes to key management and encryption
techniques. Users have little to no control over the key generation process, and the
systems do not allow customization of encryption settings based on user requirements.
This can reduce the adaptability of these systems to different security needs. While
powerful encryption techniques such as AES and RSA exist, they often require advanced
technical knowledge to implement and configure. Most systems lack an intuitive
interface that allows non-expert users to encrypt and decrypt image data easily.
Additionally, integration of features like QR code generation and image reset
functionality is often absent, making these systems cumbersome to use for everyday
applications.
In today's digital world, images and multimedia data are essential forms of
communication and documentation. However, the rapid growth of the internet and
digital storage has raised serious concerns regarding the security and confidentiality
of images, especially in sensitive fields such as healthcare, law, business, and personal
privacy. As images are frequently shared over unsecure networks, there is a heightened
risk of unauthorized access, tampering, or theft of these assets.
9
there are issues related to image size, format compatibility, and maintaining image
quality post-encryption and decryption. Many image encryption systems require
extensive user input or involve complex procedures that can be intimidating or
cumbersome for non-technical users. Some encryption methods degrade image quality
after encryption and decryption, leading to blurred or distorted images that may lose
important details. Many traditional encryption techniques do not offer strong enough
security against modern cryptographic attacks. With an increasing number of hacking
tools and decryption techniques available, relying on weak encryption can make
sensitive images vulnerable to unauthorized access. Secure image sharing, especially
over untrusted or public channels, remains a challenge. While encryption offers
protection, sharing the encryption key securely is often difficult. Without an efficient
and secure method of key exchange, the encryption might become ineffective. Some
encryption systems are designed for specific formats or require the installation of
proprietary software. This limits their ability to work across various platforms or with
different image file formats.
Implement a cryptographic solution that is simple to use and highly secure, ensuring that
images cannot be accessed or tampered with without the correct decryption key. Ensure
that the image retains its original quality (resolution, sharpness, and details) after
encryption and subsequent decryption. Incorporate QR code generation to allow users
to securely share encrypted images or the encrypted image's location through a
universally accessible format. Ensure the encryption and decryption operations are fast,
scalable, and compatible with various image formats without significant processing
overhead.
10
2.4 PROPOSED SYSTEM
The system will allow users to select an image, encrypt it using a randomly generated
key, and then decrypt the image using the same key. Additionally, the system will
integrate a feature for generating QR codes that store encrypted image data or file paths,
enhancing the security and ease of sharing. The user interface will be designed to be
intuitive, ensuring that users with little to no technical expertise can easily perform
image encryption and decryption operations.
2.5 ADVANTAGES
11
CHAPTER 3
SYSTEM REQUIREMENTS
The software requirements and also the platform description of the system are
Python 3.x: Python’s simplicity and readability make it ideal for developing GUI
applications. It also has a wide range of libraries for image manipulation and encryption,
as well as strong community support.
KEY LIBRARIES :
To build the GUI, Tkinter provides tools for creating user interface elements, while
Pillow (PIL) handles image display and manipulation. OpenCV (cv2) is used for image
encryption and decryption, with NumPy supporting necessary array operations. The
qrcode library generates QR codes from image data, and pyzbar enables QR code
scanning if needed. Together, these libraries create a robust toolkit for a feature-rich,
image-focused application.
12
3.2 SOFTWARE DESCRIPTION
A lightweight and flexible code editor with a variety of extensions for different
programming languages and frameworks. It supports Python development with
debugging, syntax highlighting, Git integration, and more.
The extensions available for Visual Studio Code allow for customized coding
environments, with tools like code snippets, automated testing, and live server
functionality to support smooth development and testing.
A high-level, interpreted language known for its versatility, readability, and vast
ecosystem of libraries. Python’s extensive library support allows developers to perform
image manipulation, GUI creation, and even encryption with ease.
3.3 SUMMARY
In summary, the system relies on Python and associated libraries to create a flexible,
user-friendly image encryption and decryption application with a focus on modularity
and maintainability.
13
CHAPTER 4
SYSTEM DESIGN
Key Management: This module generates and securely handles cryptographic keys,
using strong algorithms for randomness. It includes key storage and sharing options,
such as QR codes, while ensuring key rotation and expiration for enhanced security.
using a cryptographic key, ensuring the image data is secured during the process,
User Management: Handles user login, registration, and role-based access, ensuring
Audit and Logging: Tracks all user actions, including key generation and image
processing, with secure logs for monitoring and compliance. This helps detect
These modules ensure secure, efficient, and user-friendly image encryption and
decryption functionality.
14
4.2 KEY MANAGEMENT
The key management module handles the creation, distribution, and storage of
cryptographic keys. This module allows authorized users (like admins) to generate and
store keys securely and manage their lifecycles, including key rotation, expiry, and
revocation. By ensuring secure handling of keys, the system upholds data integrity and
confidentiality across all encryption processes.
Attribute Description
15
Table 4.2: Encryption/Decryption Process
Attribute Description
Algorithm
Supports various encryption algorithms (e.g., AES, RSA)
Selection
Audit and logging track all cryptographic activities, such as key generation, encryption,
and decryption events. This module includes maintaining records of actions, logging
errors, and creating audit trails for security monitoring. Audit logs improve
transparency and accountability by providing traceability of cryptographic actions.
Attribute Description
16
4.5 USER MANAGEMENT
In the user management module, users can create and manage their accounts, set up
authentication methods, and manage access to cryptographic functionalities. User roles
determine permissions, with admins having more control, such as access to key
management, while regular users can only perform encryption and decryption within
allowed parameters. This module helps ensure secure access to cryptographic resources.
Attribute Description
The use case diagram represents interactions between users and the cryptographic
system, illustrating key activities such as key generation, encryption, and audit logging.
Actors include Admin (for managing keys and users) and User (for encryption and
decryption actions).
17
4.5 Use case Diagram
18
4.6 Sequence Diagram
The Encryption/Decryption Process begins when the user selects a file for encryption
or decryption. The system first requests a cryptographic key from the Key
Management module. Upon receiving the key, the encryption process is initiated,
where the system applies a cryptographic algorithm to the file, turning it into an
encrypted, unreadable format. This encrypted file is returned to the user and stored
securely in the system.
19
4.8 FLOW CHART DIAGRAM
The Flow Chart Diagram for the Encryption/Decryption Process provides a visual
representation of how data moves through the system and how the various components
interact during the encryption and decryption process.
20
CHAPTER 5
TESTING
Security Measures :
Image Encryption
The project utilizes a symmetric encryption technique to encrypt and decrypt images.
The image is first converted to a grayscale format and then encrypted using a randomly
generated key based on a normal distribution. This ensures that the encryption is not
easily predictable.The image encryption is done using mathematical operations (such as
division by a random key) that make it computationally difficult to reverse the
encryption without the correct key.The key used for encryption is generated dynamically
each time the encryption process is initiated, which makes it more secure by reducing
the risk of key reuse.
Viewer: Can only view the original and decrypted images but cannot perform encryption
or decryption .
22
CHAPTER 6
CONCLUSION
The Image Encryption and Decryption system with cryptographic key generation serves
as a secure solution for image processing by generating random keys through Gaussian
noise matrices. This approach provides a basic encryption layer, but it can easily be
extended to use more advanced cryptographic algorithms like AES or RSA. The system's
GUI, developed with Tkinter, offers a user-friendly experience where users can select
images, encrypt and decrypt them, and generate QR codes seamlessly.
Looking forward, there are multiple avenues for enhancing this system. Replacing
Gaussian noise with more robust algorithms would improve security, while adding
layered or hybrid encryption could safeguard against more complex threats. Integrating
blockchain technology could secure cryptographic keys by making them tamper-proof,
traceable, and resistant to unauthorized access. Additionally, expanding file format
compatibility to support audio, video, and other media files could transform the tool into
a versatile encryption solution.
23
APPENDICES
import tkinter
from tkinter import *
import tkinter as tk
import tkinter.messagebox as mbox
from tkinter import filedialog
from PIL import ImageTk, Image
import cv2
import numpy as np
import base64
import qrcode
from pyzbar.pyzbar import decode
def reset():
global original_img
if original_img:
img = original_img.resize((400, 400))
img = ImageTk.PhotoImage(img)
panelB.configure(image=img)
panelB.image = img
encrypted_label = Label(window, text="Encrypted/Decrypted Image", font=("Arial",
20, "bold"), fg="#483D8B", bg='#F0F8FF')
encrypted_label.place(x=580, y=120)
window.protocol("WM_DELETE_WINDOW", exit_win)
window.mainloop
25
APPENDIX 2 – SCREENSHOTS
PLAIN IMAGE
IMPORT IMAGE
26
ENCRYPTED DATA
DECRYPTED DATA
27
WEB OF REFERENCES
28