Okay, okay, I think we have a war of words going on here. The problem is that there are a couple valid, but different viewpoints, with the result that we think we're all having the same conversation but we aren't.
The
Caesar Cipher is a method that, in Caesar's time, applied to
Caesar's alphabet. Romans wrote
everything -- including numbers -- with the letters of that alphabet. And it is unlikely Caesar sent messages with spaces conveniently placed in the right spots to help interceptors decode his messages -- especially as they were unnecessary anyway. (Spacing was an artifact coming from the need to make it easier for
foreigners to read the Latin texts.)
These days, we Anglophiles (incorrectly) define Caesar Ciphers to only operate over the letters A-Z. That's all fine and well, if you want to live with the distinction.
Here's the problem: Encoding != Encrypting. (Yes, it is a fine line, but it is our problem.)
Technically, Caesar
encoded his text. (In his day, it served, perhaps for some small time, as a useful
encryption method, but I doubt that it took very long for his contemporaries to figure it out.)
Those of use who know something about modern cryptography have specific vocabularies, and all these terms are fairly overloaded.
As JLBorges wrote: |
---|
In cryptography, the term "Caesar cipher" usually refers to any simple shift cipher. |
The important clause here is
in cryptography.
Otherwise we are just playing with our decoder rings where the Caesar Cipher's alphabet is arbitrarily restricted to the English A-Z.
In basic CS courses, the A-Z only cipher is a favorite assignment because it requires the student to consider several things:
- filtering text (some letters are modified and some are not)
- transforming text (via a mathematical operation and some nice indexing)
- a little discrete mathematics (modular arithmetic)
Now, when OP uses "encode" and "decrypt" in the same breath, it invites us to err in our responses. I read "decrypt" and automatically assumed he was studying cryptography. Closer thought (and OP's confusion on the subject) might have warned me that he is in a basic CS course.
Which leads to the next problem: OP was confused by the same. That was the point of his questioning. To paraphrase:
"I found stuff on the web that claims to be a Caesar Cipher but
doesn't conform to what I was taught nor to other stuff I found
on the web. What gives?"
What gives is that, strictly speaking, in most contexts, a Caesar Cipher is an A-Z ring encoder/decoder method.
In cryptography, a Caesar Cipher is a specialization of a substitution cipher, and need not be limited to A-Z. (And technically, it is still not an encryption method, but it is useful for massaging data during an encryption process.)
So, whether or not you also shift numbers and spaces and punctuation with your letters is up to you (or whatever your professor wants).
Hope this helps.