Skip to content

A Python-based tool for encrypting and decrypting messages using the cryptography library's Fernet method. The program features a simple command-line interface and automatic secret key generation for secure data protection.

License

Notifications You must be signed in to change notification settings

pkprajapati7402/Cryptography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🔒 Encryption and Decryption Program

This is a Python program that uses the cryptography library's Fernet method for encryption and decryption. It provides a simple command-line interface to choose between encrypting and decrypting a message.

🚀 Features

  • Encrypt any message using the Fernet encryption method.
  • Decrypt any previously encrypted message using the same method.
  • Automatically generates and uses a secret key for encryption and decryption.

📦 Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/encryption-decryption.git
    cd encryption-decryption
  2. Install the required dependencies:

    pip install cryptography

🛠️ Usage

  1. Run the program:

    python main.py
  2. Choose between encryption (E) and decryption (D):

    • For encryption, enter the message you want to encrypt.
    • For decryption, enter the encrypted message.

🔑 Key Management

  • The program generates a secret.key file if it doesn't exist.
  • This key is used for both encryption and decryption.
  • Keep the secret.key file safe. Losing this file will make it impossible to decrypt any messages encrypted with it.

📄 Example

Choose (E)ncrypt or (D)ecrypt: E
Enter the message to encrypt: Hello, world!
Encrypted message: gAAAAABeJc2V-MvhF7L3qfjzIHHGJ9tF5MEP3Gj2Pi8Y5kbU6iE4z6MSv1JazbTtXRXFwG1Y1NRpkRznlx0Kigc=
Choose (E)ncrypt or (D)ecrypt: D
Enter the message to decrypt: gAAAAABeJc2V-MvhF7L3qfjzIHHGJ9tF5MEP3Gj2Pi8Y5kbU6iE4z6MSv1JazbTtXRXFwG1Y1NRpkRznlx0Kigc=
Decrypted message: Hello, world!

📂 File Structure

encryption-decryption/
│
├── main.py         # The main script to run the program
├── secret.key      # The secret key file (auto-generated)
└── README.md       # This README file

🤝 Contributing

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature-branch).
  6. Create a new Pull Request.

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.


Made with ❤️ by Prince

About

A Python-based tool for encrypting and decrypting messages using the cryptography library's Fernet method. The program features a simple command-line interface and automatic secret key generation for secure data protection.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages