Caesar Cipher 99% done

I am working on a caesar cipher encrypter and decrypter program. I got the encrypter part to work. I just need help with the decryption part.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
Quick explanation for those who don't know.
In caesar cipher, when encrypting
if key = 1, the sentence XYZ, will be changed to YZA
x+1 = y
y+1 = z
z+1 = a

For decryption, it should, if key = 1
change YZA to XYZ
y-1 = x 
z-1 = y 
a-1 = z

*/


1
2
3
4
5
6
7
8
9
//For encryption, the code was as follows.

  (((int(next)) + key - 65) % 26 + 65)

//int(next) is turning next, which is a char, into an its ascii code.
//key is int to encrypt or decrypt by.
// 65 is ascii code for 1
// 26 letters of the alphabet


I am trying to decrypt with no sucess. This is the last thing left for me to do. Help please!


BTW: the code is supposedly something along these lines: m = (26 + c – k) % 26 and i am supposed to use this as my base code, but I can't figure it out.

//c = (ciphertext)
//m = (plaintext)
//k = (key)

Last edited on
Can you supply code with your solution?
it makes easier to figure it out then, otherwise we have to come out with whole solution.
Topic archived. No new replies allowed.