Skip to content

Repository files navigation

🔐 File Encryption / Decryption (Java)

A console-based Java application that encrypts or decrypts the contents of a text file using a simple Caesar Cipher algorithm. The program reads text from an input file, processes it based on the user's choice, and writes the result to a new output file.


📌 Features

  • Encrypts the contents of a text file
  • Decrypts an encrypted text file
  • Uses a simple Caesar Cipher (Shift by 3)
  • Reads data from an input file
  • Writes processed data to a new output file
  • Handles invalid user choices
  • Uses efficient file handling with BufferedReader and BufferedWriter

🛠️ Technologies Used

  • Java
  • VS Code
  • Git & GitHub

📂 Project Structure

Task-3-File-Encryption-Decryption
│
├── FileEncryptionDecryption.java
├── input.txt
├── encrypted.txt
├── decrypted.txt
├── README.md
├── .gitignore
└── Screenshots
    ├── input-file.png
    ├── encrypt-output.png
    ├── encrypted-file.png
    ├── decrypt-output.png
    └── decrypted-file.png

▶️ How to Run

1. Compile the program

javac FileEncryptionDecryption.java

2. Run the program

java FileEncryptionDecryption

3. Choose an option

1. Encrypt File
2. Decrypt File

4. Enter

  • Input file name
  • Output file name

The program will process the file and save the result.


🔒 Encryption Algorithm

This project uses a Caesar Cipher with a shift value of 3.

Example

Original Text

Hello Java

Encrypted Text

Khoor#Mdyd

Decrypted Text

Hello Java

📸 Screenshots

Input File

Input File


Encryption Process

Encryption

Encrypted File

Encrypted File

Decryption Process

Decryption

Decrypted File

Decrypted File

💡 Concepts Used

  • File Handling
  • BufferedReader
  • BufferedWriter
  • FileReader
  • FileWriter
  • StringBuilder
  • String Manipulation
  • Loops
  • Conditional Statements
  • Exception Handling
  • Scanner Class

👨‍💻 Author

Sparsh Mehta

Project completed as part of the Cognifyz Technologies Java Development Internship (Level 2 - Task 3).

About

A console-based Java application that encrypts and decrypts text files using a Caesar Cipher algorithm with Java file handling and string manipulation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages