This is a simple Java program that demonstrates encryption and decryption of messages using a key-value pair for each alphabet. It provides functionality to encrypt a message and decrypt an encrypted code back to the original message.
- Encryption: The program takes a user input message and encrypts it using a predefined key-value pair for each alphabet character. It converts each character of the message to its corresponding integer value.
- Decryption: The program allows the user to input an encrypted code and decrypts it back to the original message using the reverse mapping of the key-value pairs.
- Customizable Key: The key-value pairs for encryption and decryption can be customized according to specific requirements.
- Input Validation: The program handles input validation to ensure that only valid messages and encrypted codes are accepted.
-
Compile the Program: Compile the Java program (
EncryptionDecryption.java
) using any Java compiler. -
Run the Program: Execute the compiled program to start the encryption and decryption process. Follow the instructions provided in the console.
-
Input Message: Enter the message that you want to encrypt. You can include any characters, including whitespace.
-
Encrypted Code: The program will generate an encrypted code based on the input message and display it to the user.
-
Input Encrypted Code: Enter the encrypted code when prompted by the program.
-
Decrypted Message: The program will decrypt the encrypted code and display the original message to the user.
The encryption and decryption process relies on key-value pairs for each alphabet character. By default, the program provides the following key-value pairs: