A set of Java projects implementing various classical ciphers, including encryption, decryption, and statistical analysis for cracking.
-
Description: This project implements the Caesar cipher, a simple substitution cipher that shifts letters by a fixed distance. It also includes a statistical method to crack the cipher using English letter frequencies and chi-squared analysis.
-
Files: casear0.java, brutus.java, MonoAlphsubstitution.java
- Encrypt and decrypt text using a Caesar shift
- Automatically crack Caesar cipher using letter frequency analysis
1.Compile the program:
javac Caesar.java Brutus.java
- Run Caesar cipher with a shift:
java Caesar "text to encrypt or decrypt"
-
Crack Caesar cipher without the key:
java Brutus "encrypted text"
Example:
$ java Caesar 3 "The ships hung in the sky."
Wkh vklsv kxqj lq wkh vnb.
$ java Brutus "Wkh vklsv kxqj lq wkh vnb."
The ships hung in the sky.
Description: This project implements several substitution ciphers in an object-oriented design. It includes:
-
Substitution – abstract class implementing the Cipher interface for character-by-character encryption/decryption.
-
MonoAlphaSubstitution – monoalphabetical substitution cipher with a customizable key.
-
Caesar – special case of monoalphabetical substitution with a fixed shift.
-
Vigenere – polyalphabetic substitution cipher using a keyword for encryption/decryption.
- Files: caesar.java, substitution.java, monoAlphaSubstitution.java, Vigenere.java
-Encrypt/decrypt with monoalphabetical substitution
-Encrypt/decrypt with Caesar cipher
-Encrypt/decrypt with Vigenère cipher
-Validates command-line arguments for proper usage
1.Compile the project:
javac Substitution.java MonoAlphaSubstitution.java Caesar.java Vigenere.java
- Run MonoAlphaSubstitution:
java MonoAlphaSubstitution encrypt "text"
java MonoAlphaSubstitution decrypt "text"
-
Run Caesar:
java Caesar encrypt "text"
java Caesar decrypt "text"
-
Run Vigenère:
java Vigenere encrypt "text"
java Vigenere decrypt "text"
cipher.java