Question
I am doing ciphers in R programming and having a tough time decrypting my message with XOR cipher and Caesar cipher. This is my code
I am doing ciphers in R programming and having a tough time decrypting my message with XOR cipher and Caesar cipher.
This is my code for XOR cipher:
#XOR Encrypting
p_text<- 'I am 21' p <- utf8ToInt(p_text) k <- 9 c <- bitwXor(p,k) c_text <- intToUtf8(c)
#XOR Decrypting
c1<-utf8ToInt(c_text) d<-bitwXor(bitwXor(c1,k)) d_text<-intToUtf8(c1)
My encrypting is fine but when I run my decrypt it return the same cypher text not the plan text. I am running into the same issue with my Caesar cipher
#Caesar encrypt
p_text <- ('I live in Kentuky') ency <- utf8ToInt(p_text) ency1 <- (ency + 4) ency2 <- (ency1 %% 26) ency3 <- intToUtf8(ency2)
#Caeser decrypt
ency4 <- utf8ToInt(p_text) ency5 <- (ency - 4) ency6 <- (ency5 %% 26) ency7 <- intToUtf8(ency6)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started