PWP Report
PWP Report
ON
Encoding and decoding of message using
Substitution Cipher in python.
DIPLOMA ENGINEERING
IN
(COMPUTER ENGINEERING)
SUBMITTED BY
PRATHMESH KHANDARE
KAPIL TALI
BHAVESH RATHOD
YASH BANAIT
1|Page
DEPARTMENT OF COMPUTER ENGINEERING
DR.PANJABRAO DESHMUKH POLYTECHNIC, AMRAVATI
(A Govt. Aided Institute)
CERTIFICATE
2|Page
ACKNOWLEDGMENT
guidance and valuable time during the period of working on this dissertation.
Thank you!
3|Page
INDEX
2 Problem Definition 5
3 Introduction 6
Proposed Methodology
1) Methodology
2) Program code
5 9-12
6 Advantages and Limitations 12-13
7 Conclusion 14
8 References 15
4|Page
Problem Definition:
The goal of this project is to create a Python program that can encode and decode
messages using various encryption techniques. The program should be able to take
any input message, and encode it using a specified encryption algorithm. Similarly,
it should also be able to decode any encrypted message using the same algorithm to
recover the original message.
The project will require the implementation of various encryption techniques, such
as symmetric key encryption (AES, DES), asymmetric key encryption (RSA), and
hash functions (SHA-1, SHA-256). The program should allow the user to choose
which encryption technique to use, and also provide options for key generation and
management.
Additionally, the program should have a user-friendly interface that allows for easy
input and output of messages, as well as the ability to save and load encrypted
messages. The program should also have error handling for invalid inputs and key
mismatches.
5|Page
INTRODUCTON
In today's digital age, privacy and security of data have become increasingly
important. With the rise of internet-based communication, it has become easier to
share information with people across the globe. However, this ease of
communication has also made it easier for malicious actors to intercept and read
sensitive information. This is where encryption comes into play. Encryption is the
process of converting plaintext into ciphertext to protect the confidentiality of data.
The aim of this project is to develop a Python program that can encode and decode
messages using various encryption techniques. The program will use several
encryption algorithms, such as symmetric key encryption (AES, DES), asymmetric
key encryption (RSA), and hash functions (SHA-1, SHA-256). The program will
enable users to choose which encryption technique to use, and also provide options
for key generation and management.
The program's user interface will be user-friendly, allowing for easy input and
output of messages. The program will also have the ability to save and load
encrypted messages. Error handling will be implemented to detect invalid inputs
and key mismatches.
The program's use of hash functions like SHA-1 (Secure Hash Algorithm 1) and
SHA-256 (Secure Hash Algorithm 256) will ensure that the program provides data
integrity by verifying that the message has not been tampered with during
transmission.
In conclusion, this project will enable users to encode and decode messages
securely, using various encryption techniques. The user-friendly interface, error
handling, and strong encryption algorithms make this program a valuable tool for
anyone who wants to protect their privacy and security of their data.
6|Page
BRIEF INFORMATION
Substitution Cipher is a type of encryption technique that replaces each letter or group
of letters in the plaintext with another letter or group of letters in the ciphertext. This
type of cipher is known as a monoalphabetic substitution cipher because each letter is
replaced with a unique letter, symbol or number.
In a substitution cipher, the key is the mapping between the plaintext and the
ciphertext. The key is used to encrypt the plaintext, and it can also be used to decrypt
the ciphertext back into plaintext. The key must be kept secret to prevent unauthorized
access to the message.
There are different types of substitution ciphers, such as the Caesar Cipher, Atbash
Cipher, Polybius Square Cipher, and Vigenere Cipher. Each of these ciphers uses a
different technique to perform the substitution.
One weakness of a monoalphabetic substitution cipher is that the same plaintext letter
always maps to the same ciphertext letter. This can be exploited by an attacker to
perform frequency analysis and break the cipher. To overcome this weakness,
polyalphabetic substitution ciphers were developed. A polyalphabetic substitution
cipher uses multiple substitution alphabets, and the key determines which substitution
alphabet to use for each letter in the plaintext.
Substitution ciphers were commonly used in the past, and they are still used today in
some applications, such as secret codes and puzzles. However, they are not considered
secure for modern cryptographic purposes because they are vulnerable to brute-force
attacks and other cryptanalytic techniques.
Input:
Procedure:
7|Page
1) Create a list of all the characters.
2) Create a dictionary to store the substitution for all characters.
3) For each character, transform the given character as per the rule, depending on
whether we’re encrypting or decrypting the text.
4) Print the new string generated.
8|Page
PROPOSED METHODOLOGY
The first step in developing the program is to define the requirements. This involves
determining the encryption techniques to be used, the user interface requirements,
and any other relevant features. Based on the requirements, the program
architecture is designed, including the various components and how they will
interact with each other. Once the architecture is designed, the program is
developed, including implementing the encryption algorithms, creating the user
interface, and developing any other features required.
After developing the program, it is thoroughly tested to ensure that it meets the
requirements and functions as intended. This includes testing for any potential
vulnerabilities or errors. If any issues are identified during testing, necessary
changes are implemented to the program. After the program is tested and validated,
it is deployed to the target system(s).
Program code :
import tkinter as tk
9|Page
# Apply the substitution cipher to the plaintext
ciphertext = plaintext.upper().translate(substitution_cipher)
return ciphertext
10 | P a g e
plaintext_entry.get() key =
int(key_entry.get()) ciphertext =
encode(plaintext, key)
result_entry.delete(0, tk.END)
result_entry.insert(0, ciphertext) encode_button = tk.Button(root,
text="Encode", command=encode_text) encode_button.grid(row=3,
column=0
def decode_text(): ciphertext =
plaintext_entry.get() key =
int(key_entry.get()) plaintext =
decode(ciphertext, key)
result_entry.delete(0, tk.END)
result_entry.insert(0, plaintext)
decode_button = tk.Button(root, text="Decode", command=decode_text)
decode_button.grid(row=3, column=1) root.mainloop()
Decoding :
11 | P a g e
Advantages of system :
3. Ease of Use: With a user-friendly interface, the program is easy to use, even for
those without technical expertise in encryption. The program's simple input and
output mechanisms make it easy for users to encode and decode messages.
12 | P a g e
Limitations :
3. User Knowledge: The program's customizability and ease of use are advantages,
but users need to have a basic understanding of encryption and decryption to use
the program effectively. Otherwise, they may not know which encryption
techniques to use or how to manage encryption keys.
13 | P a g e
CONCLUSION
In conclusion, developing a Python program for encoding and decoding messages
using encryption techniques can provide significant advantages, such as improved
security, customizability, ease of use, cost-effectiveness, and transferability. However,
it is essential to consider the limitations of the program, such as processing power
requirements, key management, user knowledge, compatibility issues, and the risk of
developing a false sense of security. Despite these limitations, a well-designed Python
program for encoding and decoding messages can be a valuable tool for individuals
and organizations that need to secure their data and maintain confidentiality. With
careful consideration of its advantages and limitations, such a program can provide a
useful and efficient way to encode and decode messages using encryption techniques.
14 | P a g e
References
Website Reference:
javatpoint.com
researchgate.com
scribd.com
www.oracle.com
www.geeksforgeeks.com
15 | P a g e