practice C++ and creating Encryption Algorithms
initially created on repl.it
encrypt: Ci = (Pi + Kj) mod 26
- implicit typecast conversion to ASCII code
- add up values
- mod 26 converting sum to 0-25
decrypt: Pi = (Ci – Kj) mod 26
- implicit typecast conversion to ASCII code
- subtract values and add 26 (for neg nums)
- mod 26 converting to 0-25
- int decipherIndex = (cipherText[i] - key[i] + 26) % 26;
C = cipher text
P = plain text
K = key char - alpha key to derive cipher text offset
i = the ith character in the plain text, corresponding with cipher text index
j = jth character of the key
mod 26 returns an index within alphabetic range, 0-25
Utilizing ASCII table's mapping of character to decimal code to convert alphabet to integer, and vice versa.
Present issues with code here.