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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!