Talk:Caesar cipher

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Featured articleCaesar cipher is a featured article; it (or a previous version of it) has been identified as one of the best articles produced by the Wikipedia community. Even so, if you can update or improve it, please do so.
Main Page trophyThis article appeared on Wikipedia's Main Page as Today's featured article on April 12, 2005.
Article milestones
DateProcessResult
March 29, 2005Featured article candidatePromoted
July 19, 2008Featured article reviewKept
Current status: Featured article
Stock post message.svg To-do: E·H·W·R
Updated 2011-04-30

None listed.

Key space[edit]

what is key space in caesar cipher?

The set {1, 2, ... 26}, being all the possible offsets. Not much of a challenge, even for a human computer! --Robert Merkel 23:49 29 Jun 2003 (UTC)
Actually, it is only the set {1 ... 25} - ROT26 not being much of a cipher :) - Marcika 02:18, 12 Apr 2005 (UTC)
For Caesar, the keyspace was even smaller: {0, 1, 2, ..., 23}, where 0 and 23 are identical and 'do nothing' (as pointed out by Marcika). According to Orbis Latinus, the alphabet didn't contain more than 23 characters after the first century B.C. --Tinctorius 20:48, 26 February 2006 (UTC)

Explaining revert[edit]

A cryptogram (in the English meaning) and a cryptic crossword are not the same kind of puzzle at all. A cryptic crossword is a crossword with particular styles of clues. It does not involve any encryption. A cryptogram is a piece of text which has been encrypted with a simple substitution cipher (each letter replaced throughout with some other letter). It's meant to be solved by frequency analysis and recognizing letter patterns.

(If, as the cryptic crossword page suggests, those are called "cryptograms" in Dutch, that might be part of the confusion. The intended reference in this article is to what is called a cryptogram in English.) --FOo

Inventor?[edit]

Others are known to have used such ciphers before Caesar, so it was certainly not invented by him.

I've had a quick thumb through Kahn (and the Internet), but I can't find any reference to shift ciphers before Caesar; I don't think we can say "certainly not invented by him", or can we? An NSA page (admittedly for kids) attributes it to him: http://www.nsa.gov/kids/ciphers/ciphe00002.htm — Matt 04:57, 2 Aug 2004 (UTC)

Matt, The timeline in progress notes earlier uses of single alphabet substitution cyphers (eg, Atbash) and I think I remember that the Egyptian carving thing from thousands of years earlier was such a thing (but don't count on it). The problem would seem to be that many things get attributed to the powerful and famous (just consider authorship credits on papers written by graduate students, no), and this pollutes the attribution space with lots of squirrely data. JC would seem to have been an enthusiastic user in a military context and a powerful and famous guy generally, so things may have stuck. That we no longer have that Roman book on crypto is unfortunate for this. If we simply say that single alph sub cypher wasn't his, we would certainly be safe. ww 16:27, 2 Aug 2004 (UTC)
I've added a (somewhat cautious) replacement. — Matt 00:58, 3 Aug 2004 (UTC)

Cryptanalysis[edit]

The History section relates cryptanalysis of the caesar cipher and frequency analysis. That's the nice way to do it, but since brute force is so trivial and obvious for this cipher, can we really even talk about "methods of breaking the cipher" being unavailable? I mean, it's a *Caesar cipher*. :) Lunkwill 21:21, 2 Aug 2004 (UTC)

Sure ;) I presume you're referring to "furthermore, there is no record that any method was then known which would reliably break such a cipher". Perhaps here, though, it was assumed that "the enemy doesn't know the system", in which case frequency analysis would be very useful. — Matt 00:49, 3 Aug 2004 (UTC)

Hmm..yeah, having thought about it, perhaps this cryptanalysis section would be better merged into frequency analysis or substitution cipher; most of it is pretty general. — Matt 00:45, 24 Nov 2004 (UTC)

Good job[edit]

I just wanted to congratulate the authors of this article. Although a very simple topic, they've really done a great job of explaining it while using it as a demonstration of simple cryptography and cryptanalysis. I'm impressed. Deco 03:24, 12 Apr 2005 (UTC)

Thanks for your kind comments! — Matt Crypto 12:02, 12 Apr 2005 (UTC)

Fixed example[edit]

One of the examples in the article stated that "AFCCQ" would rotate to either "jolly" or "cheer". It doesn't; it rotates to "jollz" and "chees". I fixed the example to read "AFCCP" instead. This is my first edit of a featured article in particular, so I hope I wasn't meant to go through any sort of process for it; something I only thought about after I'd done so. --Ciaran H 15:14, Apr 12, 2005 (UTC)

Thanks for spotting this! I copied it mindlessly from Bauer's Decrypted Secrets without checking. Do the other ones work? You are most definitely allowed to change even featured articles, and especially if they've got (cough) mistakes in them ;-) While checking, I also noticed that "AFCCP" could also become "diffs" (which isn't a dictionary word, of course, but it's a common bit of jargon on Wikipedia and elsewhere). — Matt Crypto 15:23, 12 Apr 2005 (UTC)
Ha! I love it when I find mistakes in published books. :P As far as I can see, the others are fine, although I wonder at the "attackatonce" example table, as the shifts are in reverse order. From "exxegoexsrgi", the text "attackatonce" would technically be a shift of 22, not 4. Or am I misreading something? --Ciaran H 15:32, Apr 12, 2005 (UTC)
It depends which way you're looking at it: if you're viewing it as a brute force attack, you're trying each possible encryption key (right shift), and decrypting the ciphertext with it — a decryption is a shift in the opposite direction to encryption (left shift). I've changed the heading of the table, hopefully it makes it clearer? — Matt Crypto 15:43, 12 Apr 2005 (UTC)
It makes sense now, yes, but now it seems that the column is too wide. Would just "Decryption shift" or "Reverse shift" work? --Ciaran H 15:48, Apr 12, 2005 (UTC)
I've changed it to "Decryption shift", which is a bit smaller. — Matt Crypto 15:55, 12 Apr 2005 (UTC)
Sounds good. I also right-aligned the numbers so that it looks better. Are you happy with this? --Ciaran H 15:59, Apr 12, 2005 (UTC)
I've tried central alignment, which (personally) I think looks slightly better in the wide column, but I don't really mind much either way. — Matt Crypto 16:04, 12 Apr 2005 (UTC)
Centre alignment works too. ;) Would it be worth centering the plaintext as well? --Ciaran H 16:05, Apr 12, 2005 (UTC)
Might as well - done. — Matt Crypto 16:09, 12 Apr 2005 (UTC)

Advanced Breaker[edit]

Where could I find an advanced caesar Cipher breaker? I need it to figure out strings such as delta=-?,+?,-?,+?,-?,+?,... and possibly do it backwards for me too. I have no idea where to even begin to break a cipher in which the delta is unknown!!! Jaberwocky6669 05:06, Jun 21, 2005 (UTC)

I presume you aren't talking about the Caesar cipher as described in this article, because the article goes into quite some detail about how to break those...perhaps you mean a shift cipher where the shift can vary with each letter, as opposed to being fixed? If the shift varies according to a repeating keyword, the scheme is usually called a Vigenere cipher. Have I understood correctly what you're describing? — Matt Crypto 13:57, 21 Jun 2005 (UTC)
  • You understood puuurrfectleee... thanks! I am trying to solve an internet riddle thingie lol... Jaberwocky6669 18:46, Jun 22, 2005 (UTC)

Article recommended in School Library Journal[edit]

This article got recommended in an a feature in School Library Journal this month, where they had a feature on websites about codes and ciphers. Apparently, "they select a topic, in this case Codes and Ciphers, and present websites that they believe will be helpful to students and teachers. Each one has a short summary/review". The review for this article was, "This Wikipedia article shows you how the Caesar Cipher works, and how to break it! It also explains some of the history of how Julius Caesar used it" [1]. — Matt Crypto 18:25, 1 September 2005 (UTC)

Stream ciphers[edit]

This article is in the Stream ciphers category. Does it really qualify? Beacuse it doesn't do what is described on the stream cipher's article "the transformation of successive digits varies during the encryption." I think I could argue it either way (it's just a really simple stream cipher), but I thought someone should at least bring it up. Broken S 22:52, 21 November 2005 (UTC)

I've removed the category; it's not really a stream cipher, not in how people would normally understand and use the term, at least. — Matt Crypto 15:47, 22 November 2005 (UTC)
I added the Vigenere cipher to the category though, I think that is proper (I'd say Vigenere is the most simple of the stream ciphers). Broken S

Relevance Today...[edit]

Could someone write about the cipher's relevance today? When learning cryptographic methods, one inevitably is told of the Caesar Cipher. Perhaps someone should write about how it's used as a building block on developing more complex methods... —Preceding unsigned comment added by 70.104.85.250 (talkcontribs)

Well, it's not, really. There's ROT13, but that's not really cryptography per se. — Matt Crypto 07:43, 18 June 2006 (UTC)
I'd rephrase that a bit. The Caesar cypher and all its relatives before and after hasn't been effective cryptography since ca 1000CE when the Arabs discovered frequency analysis. This ineffectiveness (ie, complete fecklessness) is so, even if a particular Opponent is a tad slow and hasn't heard of frequency analysis. As is often quipped, it "may be good enough for keeping your kid sister out" of things, but not for much else. Newspaper puzzles maybe; at least the less challangeing sort. ww 13:28, 18 June 2006 (UTC)

mod operator is not well defined[edit]

There have been a couple of incorrect reverts. There is no generally used definition of when is negative. E.g., the remainder of can be either -2 or 3. Which of this two values is used depends widely on the context, where the operator is used. In crypto is usually defined such that and (assuming ). To be correct the article should clearly state the definition of mod. 81.62.90.36 09:21, 12 December 2006 (UTC)

OK, good point. Perhaps, then, we should go the route of explicitly defining "mod" as you suggest, in the interests of keeping the encryption and decryption formulae simple. The alternative is to add 26 to the formula to ensure it's positive, but that might be less clear to the reader. As it's really just a technicality, we could even do it in a footnote. — Matt Crypto 09:33, 12 December 2006 (UTC)

Misleading Example?[edit]

I'm not a cryptographer but my reading of Suetonius is that Julius Ceasar's code was a shift of -3, or three to the left. The examples given, while not specifically being noted as having Caesar's shift do have a shift of three, but three to the right. For example, in the example:

Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC

From Suetonius: "If anyone wishes to decipher these ... he must substitute the fourth letter of the alphabet, namely D, for A, and so with the others."

This implies to me that to read the encoded text you would substitute the letter D whenever the letter A is encountered in the cipher. The example above the result would be an X for A. Jhohorst 02:54, 17 July 2007 (UTC)

Good point - fixed. Zsero 03:33, 17 July 2007 (UTC)
Yeah, it seems ambiguous, depending on what "substitute for" means. To my mind, if you substitute D for A, it could well mean that you replace A with D. This is the interpretation taken by Kahn and others. I wonder if the original language is clearer? I think we're safer just describing Caesar's cipher with a shift of three, rather than specifying which direction. — Matt Crypto 05:23, 17 July 2007 (UTC)
"To my mind, if you substitute D for A, it could well mean that you replace A with D." Yes, that is exactly what it means. But note that Seutonius is describing how to decrypt the message, not how to encrypt it. Therefore the cipher is a left shift. It's not ambiguous at all. Unless the translation is wrong, but why would we suspect that? Zsero 05:30, 17 July 2007 (UTC)
Heh, yes, I got muddled — early morning editing is never a strong point for me. But I do think it's ambiguous, and certainly all the books (I've read) on the history of cryptography read it being a right shift. They may well all be mistaken, but I think our best option is to just omit specifying the direction of the shift of the historical cipher in the article. For reference, the original Latin was apparently:
extant et ad Ciceronem, item ad familiares domesticis de rebus, in quibus, si qua occultius perferenda erant, per notas scripsit, id est sic structo litterarum ordine, ut nullum verbum effici posset: quae si qui investigare et persequi velit, quartam elementorum litteram, id est D pro A et perinde reliquas commutet.
(Not that I can read a word of it). — Matt Crypto 06:31, 17 July 2007 (UTC)

Correct mathematical formula[edit]

In the Romanian article it is:

In the English article it is:

And in the Spanish one it is:

All these are featured articles. So, which formula is correct in the end? diego_pmc (talk) 17:26, 28 March 2008 (UTC)

They're all right. It depends on the alphabet, of course. -- Zsero (talk) 18:48, 28 March 2008 (UTC)

Daily Mail source[edit]

Kudos to Hut8.5 for his cleanup and tracking down some sources for this article. I'm a bit worried, though, by the Daily Mail cite -- the newspaper is not a particularly scholarly source. I wouldn't at all be surprised, for example, if the Daily Mail had used Wikipedia as a source itself (given that this article was featured on Wikipedia's main page a couple of weeks before the newspaper article was published). — Matt Crypto 18:14, 16 June 2008 (UTC)

I didn't realise that. Feel free to remove it - it was the only one I could find for that statement. Hut 8.5 18:36, 16 June 2008 (UTC)

Group[edit]

Hi :)
I'd like to add something about the last sentence of the article "In mathematical terms, the encryption under various keys forms a group." I think that it should be reformulated. Actually, saying that the encryption forms a group means nothing to me. It would be better to write that the set of ciphers, with the law of composition for applications, forms a group.

Finally, i'd like to say that i'm french so maybe I misunderstood the sentence ! Sorry if this is the case. --Shiningfm (talk) 01:20, 29 September 2008 (UTC)

Infobox[edit]

I have just removed the infobox from this page. It has been around since 2007 and I am surprised that no one has complained about it. It's use for modern encryption schemes is fine, the template was designed for that. In this instance however, too few fields are filled in and the result looks like a malformed infobox. If you feel that for uniformity there should be an infobox on this page, then don't use the template, just build one as a table so that it can be customized for this cipher.Bill Cherowitzo (talk) 04:00, 13 October 2015 (UTC)

Huh. (checks the clock) It's been over a year since you left the comment! As the person who added the infobox in question in the first place (I think, my memory is hazy), I guess I should comment, as is the norm in case of the absurdities of Wikipedia. Anyway: I do agree that there weren't many fields filled in, and I probably should have filled in more fields back in the day when I had time, but I expected the fields to be filled in due time in the generally accepted spirit of eventualism. Also, the infoboxes generally help the articles inside the subject matters. Though, I admit I did pick the just about only infobox template that I could find at the time, and that particular one was best geared for modern ciphers. Are there better suited infoboxes for ancient ciphers before the modern distinctions and classifications? Please advise, this article (like articles of other old ciphers) looks quite bleak without an appropriate infobox. --wwwwolf (barks/growls) 02:32, 21 October 2016 (UTC)
In my eyes, the article doesn't look bleak as it is. If anything, the removal of the 4 apparently unmotivated lines (as last seen here) took away some bleakness. But Wwwwolf touches on a point: Infoboxes also serve a purpose for classification and distinction. That's something that could be improved in this article, as I will write below. Sebastian 11:39, 24 April 2018 (UTC)
Striking my last two sentences, because I don't want to jump to the conclusion that just because I overlooked something it wasn't clear enough. ◄ Sebastian 12:00, 24 April 2018 (UTC)

Removal of Sentence[edit]

I would like to remove this line:

In April 2006, fugitive Mafia boss Bernardo Provenzano was captured in Sicily partly because some of his messages, written in a variation of the Caesar cipher, were broken. Provenzano's cipher used numbers, so that "A" would be written as "4", "B" as "5", and so on.[11]

This is because it doesn't really add to the article and popularises a modern crime figure compared with a historical leader. Theblogger01 (talk) 20:40, 7 April 2016 (UTC)

Yes, you removed it a few times "because it popularises an organised crime group", as you said. I don't think it popularises the group. In my opinion it is a short, neutral, properly sourced, and sufficiently relevant example of the article subject. After all, we also have an article on Bernardo Provenzano. So I have restored the content, as did user Wcherowi. What do other contributors think? - DVdm (talk) 20:51, 7 April 2016 (UTC)
I disagree with the removal. Including neutral encyclopedic coverage of an organised crime figure in a location where that content is relevant is not in any sense promotional. The article does not imply that Provenzano is a historical figure with comparable stature to Caesar, just that both of these people made use of the cipher. I also don't see how someone could think that it "doesn't really add to the article". Hut 8.5 21:19, 7 April 2016 (UTC)
@Hut 8.5: It would make more sense to see more positive modern uses of this cipher rather than the examples given. So it is not really neutral and according to the source it is more anecdotal than encyclopedic. However, would you both agree to an edit of the sentence rather than a deletion?Theblogger01 (talk) 22:20, 7 April 2016 (UTC)
I noticed that you made a slight change, by adding the phrase "badly executed version". We could also replace "badly" with "clumsily", as that term appears in the title of the article, but I think "badly" pretty well covers the tone and the content of the source. Good job, and welcome to collaborative editing! - DVdm (talk) 06:42, 8 April 2016 (UTC)
I've reverted the edit. The point made by the source isn't that the cipher was executed imperfectly, it's that the cipher itself is extremely insecure (which explains why there are so few modern examples). If you'd like to rephrase it to emphasise that then I could go along with it. Hut 8.5 06:49, 8 April 2016 (UTC)
Yes, fair enough. Perhaps we could say "clumsily written in a variation of the Caesar cipher"? - DVdm (talk) 06:55, 8 April 2016 (UTC)
That's a good compromise @DVdm:. I'll put that in.Theblogger01 (talk) 15:11, 8 April 2016 (UTC)

Decryption Tool[edit]

Quite some time ago, I created a Caesar cipher decryption tool, based on a frequency heuristic, where you can paste some text and the right key is guessed. The tool is the most linked and most frequently visited page of my blog, which might be a slight indicator, that people see in it a valuable resource.

As Wikipedia is a collection of valuable resources and information, I proposed to add the tool https://www.xarg.org/tools/caesar-cipher/ for the external pages section.

Unfortunately, the change was reverted automatically as I got explained here: https://en.wikipedia.org/wiki/User_talk:Xarg

However, as I wrote, I don't think this is an advertising other than bringing in a valuable reference to Wikipedia and so I would be glad if you add the link permanently if the resource meeds your quality demands. I assure that this link will be available and that I own the site. — Preceding unsigned comment added by Xarg (talkcontribs) 03:15, 21 July 2018 (UTC)

Implemented the algorithm in python[edit]

Hey there i have implemented the algorithm in python, perhaps it will help the programmers to understand how it works. Please feel free to comment here — Preceding unsigned comment added by 182.75.188.170 (talk) 14:06, 4 July 2019 (UTC)

I've removed this as I don't think it adds anything to the article. Wikipedia isn't a source code repository, code is only included if it significantly enhances the reader's understanding of the topic. The Caesar cipher is so simple that even small children can easily grasp the algorithm, it doesn't need code to explain it. Most of the code which was added related to the practicalities of handling different types of string characters rather than the actual algorithm itself. Hut 8.5 20:56, 4 July 2019 (UTC)

Programming samples[edit]

This article often gets implementations of the cipher in common programming languages added, e.g. this JavaScript example. I don't think these add anything meaningful to the article. The algorithm for the Caesar cipher is so simple it can be encapsulated in one simple formula, as in the "Example" section. Any well-written code example will also only have one line devoted to the actual enciphering, which is the same as the formula given earlier. Most of the code is invariably devoted to iterating through the input string, converting the string characters into numbers, and assembling the output, instead of implementing the actual cipher itself. As a result the reader doesn't gain anything from reading the example. Hut 8.5 15:38, 26 April 2020 (UTC)