Substitution Encryption/Decryption in R
问题 Using the variables alpha and key, encrypt ptext into a variable named ctext. Using substitution cipher So I have a text file separated in a vector ptext <- strsplit(ptext,split = "", fixed = TRUE) ptext <- unlist(ptext) I also created a key for this cipher key <- "ZGYHXIWJVKULTMSARBQCPDOENF" key <- unlist(strsplit(key,"")) and an Alphabet vector for the key alpha <- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" alpha <= toupper(alpha) alpha <- unlist(strsplit(alpha,"")) Now my goal is to try to replace all