Skip to content

YuliyaZimenina/FileEncryptionAndDecription

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Encryption & Decryption

(DESede Algorithm)

This project demonstrates working with cryptography (the DES encryption algorithm) in a Java program.

Table of contents

  1. Description
  2. Technologies
  3. Installation and Running
  4. Author
  5. Usage Example
  6. Screenshots

Description

The Java program demonstrates the process of encrypting and decrypting text in files using the Triple DES (DESede) algorithm.

Features

  • Reads text from inText.txt
  • Encrypts content with DESede algorithm
  • Decrypts the encrypted text
  • Prints the original, encrypted, and decrypted text to the console
  • Writes the result to the outFile

Note

  • The DESede (Triple DES) algorithm is considered outdated for real-world applications, but it work well for demonstrating encryption principles.
  • For production use more modern algorithms such as AES or RSA are recommended.

Technologies

  • Java SE (version 17)
  • javax.crypto (Cipher, KeyGeneration, SecretKey)

Installation and Running

  1. Clone the repository:
git clone https://github.com/YuliyaZimenina/FileEncryptionAndDecription.git
cd FileEncryptionAndDecription
  1. Open the project in your favorite IDE (IntelliJ IDEA, Eclipse, etc.).
  2. Make sure Java 17 is set as the project SDK.
  3. Create an input file:
src/inText.txt

Put any text inside to be encrypted

  1. Run the Main.java file

Author

Yuliya Zimenina

Usage Example

public class Main {
    public static void main(String[] args) throws Exception {
        File inFile = new File("src\\inText.txt");
        File outFile = new File("src\\outFile");

        byte[] sourceText = new byte[(int) inFile.length()];

        // Convert file to bytes
        FileInputStream fileInputStream = new FileInputStream(inFile);
        fileInputStream.read(sourceText);
        for (int i = 0; i < sourceText.length; i++) {
            System.out.print((char) sourceText[i]);
        }

...

Screenshots

  1. The result of the program:

The result of the program.

  1. Source text for encryption:

Source text.

About

Encryption of text in a file and decryption. DES algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages