Ask your own question, for FREE!
Mathematics 6 Online
OpenStudy (hyroko):

I am having trouble with my affine caesar cipher decoding. I'm taking ascii values, subtracting 97 to get 0-25, applying the shift, then adding 97 back to get the cipher text, and that encodes just fine. But my decoding is getting a wrong output every 5th and 6th number, and I'm not sure why.

OpenStudy (hyroko):

Here is the code public class KeyGen { public void encrypt(ArrayList plainText, ArrayList cipherText) { for(int i = 0; i < plainText.size(); i++){ int ct = (int) plainText.get(i); ct = ((((ct-97) *5) +8)%26)+97; cipherText.add(ct); System.out.print((char)(int)cipherText.get(i)); } } public void decrypt(ArrayList cipherText, ArrayList decodedText){ for(int i = 0; i < cipherText.size(); i++){ int ct = (int) cipherText.get(i); ct = ct-97; ct = (abs((ct-8))*21 %26)+97; decodedText.add(ct); } } }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Mari103: How to pop out like a Jacc In the box
8 hours ago 0 Replies 0 Medals
Breathless: Spooky witch but cute
15 hours ago 3 Replies 0 Medals
Arriyanalol: help
14 hours ago 10 Replies 2 Medals
Arriyanalol: @tinydinoUwU stop trying to find a argument u blad lil boy
1 day ago 5 Replies 4 Medals
Jaded012023: Please tell me what you all think of this song
17 hours ago 6 Replies 1 Medal
Arriyanalol: bro how
17 hours ago 2 Replies 3 Medals
Arriyanalol: cant wait for the new bluey movie in 2027
1 day ago 12 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!