code/cryptography/src/autokey_cipher/README.md
Auto Key Cipher is a Symmetric Polyalphabetic Substitution Cipher. This algorithm is about changing plaintext letters based on secret key letters. Each letter of the message is shifted along some alphabet positions. The number of positions is equal to the place in the alphabet of the current key letter.
Formula used for Encryption:
Ei = (Pi + Ki) mod 2
Formula used for Decryption:
Di = (Ei - Ki + 26) mod 26
Pseudo Code
nextkey = text[i] - 'A';
text[i] = (text[i] - 'A' + keyvalue) % 26 + 'A';
result = (text[i] - 'A' - keyvalue) % 26 + 'A';
text[i] = result < 'A' ? (result + 26) : (result);