This program encrypts a plain text message using the substitution cipher.
The program takes in 1 command-line argument, an integer, as the cipher key. The plain text message input will be requested after the program is run.
The argument should be a 26 character string with no repeated characters. From the CS50 documentation:
A key, for example, might be the string
NQXPOMAFTRHLZGECYJIUWSKDVB
. This 26-character key means thatA
(the first letter of the alphabet) should be converted intoN
(the first character of the key),B
(the second letter of the alphabet) should be converted intoQ
(the second character of the key), and so forth.
$ ./substitution JTREKYAVOGDXPSNCUIZLFBMWHQ
plaintext: HELLO
ciphertext: VKXXN
$ ./substitution VCHPRZGJNTLSKFBDQWAXEUYMOI
plaintext: hello, world
ciphertext: jrssb, ybwsp