This Python application integrates various cryptographic functionalities into a single interactive program. Users can perform encryption, decryption, hashing, digital signature generation/verification, and Message Authentication Code (MAC) generation.
Developed by Alina Hasan
-
AES Encryption/Decryption
Supports encryption and decryption using AES in ECB or CBC modes. Users can input plaintext/ciphertext, specify the AES mode, provide keys, and select the desired operation. -
RSA Encryption/Decryption
Implements RSA for encrypting and decrypting messages. Users can generate RSA keys and perform encryption or decryption. -
Hashing
Provides hashing functionalities using SHA1, SHA256, and MD5. Users can input data and select the hashing algorithm. -
Digital Signature using RSA
Facilitates the creation and verification of digital signatures to ensure message integrity and authenticity. -
MAC Generation
Supports generation of Message Authentication Codes using CMAC (Cipher Block Chaining-MAC) and HMAC (Hash-based Message Authentication Code).
Before running the program, install the required cryptographic library:
pip install pycryptodome
Run the program in a Python environment. Upon execution, a menu will appear with the following options:
-
AES Encryption/Decryption
- Choose ECB or CBC mode.
- Specify whether to encrypt or decrypt.
- Input the message and key.
-
RSA Encryption/Decryption
- Generate RSA keys (private and public).
- Choose encryption or decryption.
- Input the required keys and message.
-
Hashing
- Select the hashing algorithm (SHA1, SHA256, or MD5).
- Input the message to hash.
-
Digital Signature using RSA
- Generate a signature or verify an existing one.
- Provide the necessary keys and message.
-
MAC Generation
- Choose between CMAC and HMAC.
- Input the message to generate the MAC.
-
Exit
- Quit the application.
- Mode: CBC
- Message:
HelloWorld
- Key:
mysecretkey
Encrypted text: b'\xab\xcd\xef...'
Decrypted text: HelloWorld
-
Generate keys:
- Prime Numbers:
p = 17
,q = 23
- Public Key (e, N):
(3, 391)
- Private Key (d):
275
- Prime Numbers:
-
Encrypt:
M = 42
Encrypted message: 180
-
Decrypt:
C = 180
Decrypted message: 42
- Algorithm: SHA256
- Message:
SecureHash
Hash Value: 7c2a55...e3a6f9
- Message:
VerifyThis
- Signature: Generated using RSA private key.
- Verification: Valid or Invalid.
- Message:
AuthenticateMe
- CMAC/HMAC: Generates a unique signature for the message.
pycryptodome
for cryptographic functionalities.hashlib
,base64
,os
,hmac
for supporting utilities.
- AES: Encryption/Decryption using block ciphers.
- RSA: Public/Private key cryptography for secure communication.
- SHA1/SHA256/MD5: Hash functions for integrity.
- MAC: Ensures authenticity using CMAC or HMAC.
- Prime checking using
is_prime
function. - Coprime validation for RSA key generation.
- Extend support for additional algorithms (e.g., DES, RSA-OAEP).
- Add a GUI for improved user experience.
- Provide more robust error handling for invalid inputs.
This project is for academic purposes. Redistribution or commercial use is prohibited without permission.
Alina Hasan
Email: alina.hasan@g.bracu.ac.bd
ID: 20101301