Caesar Cipher and non printing ascii
843810Nov 28 2004 — edited Nov 29 2004I am writing a program to implements the caesar cipher. For the program I am using ASCII code so my encryption algorithm is:
c = (p + k) mod 128
The only problem is, is that depending on the characters being encrypted and depending on the key I use some of the characters are encrypted to non-printing ascii characters such as 'del'.
So my code reads in the plain text from a file converts each character to ascii, encrypts each character using the key. It then writes the encrypted ascii values to a file as text (i.e. the character equivalent of the ascii).
If I do then encounter a non-printing ascii value it is written to the file as a square shape. Is there any way I can get around this?
Thanks for your help on the matter.
Wallace