I'm attempting to write a function that will encrypt or decrypt an inputted string. A string is declared to represent the alphabet (ALPHABET), and lists all acceptable characters. A permutation of this string is then generated randomly, using a user-defined seed. My intent is for each replaced character of the permutation to then replace the corresponding characters as they occur in the string. I'll simulate a running of the code posted below and the output to illustrate what I mean.
Input seed
1
Input message to decrypt:
Original ALPHABET: - ABCDEFGHIJKLMNOPQRSTUVWXYZ.,'
Permutation of ALPHABET: - S'XHYIGEO.DBVPQKLZMCFRWTAN,JU
Inverse of Permutation: - YLTKHUGDF,PQSZINOVAX'MWCERJ.B
Input any single character to begin
Encryption / decryption, or 'Q' to [Q]uit
a
Type your message below
AMESSAGE
Input 'E' to [E]ncrypt, 'D' to [D]ecrypt:
After this, the message should either be encrypted, using the permutation, which has already been coded, or decrypted, using the inverse of that permutation, also already coded.
Here's what I have so far, and thanks in advance for any assistance. I've tried a dozen things to try and make this work so I'd appreciate any help offered.