This is a simple encryption and decryption program implemented in C++ that demonstrates how to apply a basic encryption algorithm. The program uses a key-based system to encrypt and decrypt user-inputted strings.
- Encryption: The program encrypts the user's input string by adding a key value to each character's ASCII code.
- Decryption: The program decrypts the encrypted string by subtracting the key value from each character's ASCII code.
- Key Algorithm: A simple algorithm using a constant key value generated by a mathematical expression (
pow(2, 2 * 5 / 4)
).
-
User Input:
- The program prompts the user to input a string or password that they want to encrypt.
-
Encryption:
- The
Encryptionvar
function takes the input string and the encryption key (calculated aspow(2, 2 * 5 / 4)
). - Each character of the string is modified by adding the key value to its ASCII code.
- The
-
Decryption:
- The
Decryption
function takes the encrypted string and subtracts the same key value from each character's ASCII code to retrieve the original string.
- The
-
Key Calculation:
- The key is calculated using the expression
pow(2, 2 * 5 / 4)
, which results in the key value16
.
- The key is calculated using the expression
git clone https://github.com/TariqCodeBit/SimpleEncryption.git
Please Enter Your string or password you need Encryption:
Tarek
_______________[ Encryption ]_______________________
Xevio
_______________[ Decryption ]______________________
Tarek
- by Tarek.