Skip to content

Latest commit

 

History

History
111 lines (94 loc) · 2.89 KB

README.md

File metadata and controls

111 lines (94 loc) · 2.89 KB

Email Encryption using Blowfish Algorithm

Introduction

Project

Structure
.
├── algo.py
├── blowfish_algo.py
├── README.md
├── receive.py
└── send.py
File description
File Description
algo.py Methods to Encrypt and Decrypt using Blowfish algorithm
send.py Encrypt message and Send email
receive.py Receive email and Decrypt message

Algorithm

Blowfish

Blowfish is a symmetric block cipher that can be used as a drop-in replacement for DES or IDEA. It takes a variable-length key, from 32 bits to 448 bits, making it ideal for both domestic and exportable use.

Setup

Cipher key

Admin key is the symmetrical cipher key used by Blowfish algorithm for both Encryption and Decryption. Set a custom admin_key in the algo.py file.

# Replace admin_key with string
# Size > 4 bytes
cipher = blowfish.Cipher(b"admin_key")
Testing

Testing Blowfish algorithm

python algo.py

Must generate the following output

JuxX3vmzzDqblD/SZJyJ8PICXrVfzcBWZZBX6Kk=
Testing Blowfish: Success ✓
Email (Gmail)
Sending email

Replace values with sender Email ID and Password and receiver Email ID in the send.py file.

fromx = "[email protected]"
to = "[email protected]"
password = "password"

Additional Setup for sending email using Gmail.

Receiving email

Replace values with sender Email ID and Password receive.py file.

user = '[email protected]'
password = 'password'

Additional setup for receiving email from Gmail.

Run
# Encryption message and
# Sending email
python send.py

# Receiving email and
# Decryption message
python receive.py

Result

Encode and Send E-mail
Enter message to send: Testing email encryption using Blowfish algorithm.

Sending email ...
----------------------------
From:    [email protected]
To:      [email protected]
Subject: ENC: Sample mail
Message:
 CCn4VdEuE33qHpW197H+5+sBTcKO/7vvIllr9eE4MGnx4cYlH8VISLAvBp3+fYEkoZk=
----------------------------

Message sent ...  ✓
Receive and Decode E-mail
Raw email content
-----------------------------
...
Subject: ENC: Sample mail
From: [email protected]
To: [email protected]

CCn4VdEuE33qHpW197H+5+sBTcKO/7vvIllr9eE4MGnx4cYlH8VISLAvBp3+fYEkoZk=
-----------------------------

Encrypted message
CCn4VdEuE33qHpW197H+5+sBTcKO/7vvIllr9eE4MGnx4cYlH8VISLAvBp3+fYEkoZk=

Decrypting ...
Decrypted message ✓
Testing email encryption using Blowfish algorithm.