Class UnbreakableEncryption
java.lang.Object
org.example.chapter1_small_problems.UnbreakableEncryption
Unbreakable encryption with one-time cipher.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringDecryption KeyPair to original string.static voiddecryptImage(KeyPairImages keyPair, String path) Decryption KeyPairImage to original image.static KeyPairString encryption to KeyPair.static KeyPairImagesencryptImage(String original) Image encryption to KeyPairImage.
-
Constructor Details
-
UnbreakableEncryption
public UnbreakableEncryption()
-
-
Method Details
-
encrypt
String encryption to KeyPair.- Parameters:
original- string to be encrypted- Returns:
- key pair with dummy and encrypted keys
-
decrypt
Decryption KeyPair to original string.- Parameters:
keyPair- key pair with dummy and encrypted keys- Returns:
- string decrypted from key pair
-
encryptImage
Image encryption to KeyPairImage.- Parameters:
original- path to the image- Returns:
- key pair with BufferedImage and dummy key
- Throws:
IOException- if file from 'path' doesn't exist
-
decryptImage
Decryption KeyPairImage to original image.- Parameters:
keyPair- key pair with dummy and encrypted keyspath- path to the image- Throws:
IOException
-