.
├── algo.py
├── blowfish_algo.py
├── README.md
├── receive.py
└── send.py
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 |
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.
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 Blowfish algorithm
python algo.py
Must generate the following output
JuxX3vmzzDqblD/SZJyJ8PICXrVfzcBWZZBX6Kk=
Testing Blowfish: Success ✓
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.
Replace values with sender Email ID and Password receive.py file.
user = '[email protected]'
password = 'password'
Additional setup for receiving email from Gmail.
# Encryption message and
# Sending email
python send.py
# Receiving email and
# Decryption message
python receive.py
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 ... ✓
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.