Implementations of ciphers in Java for educational purpose.
public class Main {
public static void main(String[] args) throws IOException {
// Encrypt
String secret = new CaesarCipher(17).encrypt("Hello, Caesar!");
System.out.println(secret);
// => Yvccf, Trvjri!
// Prepare decryption
String file = "dictionary-book.txt";
CaesarBreakerOneKey b = new CaesarBreakerOneKey(file);
// Decrypt
b.decrypt(secret);
if (b.canDecrypt()) {
System.out.println(b.key + " | " + b.decrypted);
// => 17 | Hello, Caesar!
} else {
System.out.println("Can't decrypt");
}
}
}
- Dictionary: http://app.aspell.net/create
- Documentation: https://gitzart.github.io/cipher