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 String
Decryption KeyPair to original string.static void
decryptImage
(KeyPairImages keyPair, String path) Decryption KeyPairImage to original image.static KeyPair
String encryption to KeyPair.static KeyPairImages
encryptImage
(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
-