Simple, yet efficient, S-DES implementation in java that supports stream and string encryption.
S-DES (Simplified Data Encryption Standard) - is an educational rather than a secure symmetric encryption algorithm. It has similar properties and structure to DES with much smaller parameters.
You can simply copy-paste SDES implementation to your project from SDES/src/main/java/cryptography/SDES.java
Alternatively, you can build a .jar file and use it as a library:
cd
into the desired directory and clone the project:git clone https://github.com/Marakaido/SDES.git
.- Build the project:
chmod +x ./gradlew & ./gradlew build
- If successfull, .jar can be found at
SDES/build/libs
. Test summary is located atSDES/build/reports/tests/test/index.html
. - Add the .jar file to your project's classpath
int key = 0b0100011011;
String plainText = "plain text";
// Encrypt plain text
String cypherText = SDES.encrypt(plainText, key);
// Decrypt cypher text
String decypheredText = SDES.decrypt(cypherText, key);
int key = 0b0100011011;
InputStream in = new BufferedInputStream(Files.newInputStream(Paths.get("data.txt")));
OutputStream out = new BufferedOutputStream(Files.newOutputStream(Paths.get("encrypted.txt")));
// Encrypt
SDES.encrypt(in, out, key);
// Decrypt (for demonstration purposes, we use the same streams)
SDES.decrypt(in, out, key);
To run the tests: ./gradlew test
Test summary is located at SDES/build/reports/tests/test/index.html
This project is licensed under the MIT License - see the LICENSE.md file for details