Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a type of alphabet cipher in which each character is defined based on how distant it is (in the alphabet) from the preceding character.

So, assuming that A=0, B=1, C=2, etc., and you have a text input of "GOOSE," you would construct the output like this:

G (6) is 2 letters in front of E (4), so output is C (2);
O (14) is 8 letters in front of G (6), so output is I (8);
O (14) is 0 letters in front of O (14), so output is A (0);
S (18) is 4 letters in front of O (14), so output is E (4);
E (4) is 12 letters in front of S (18), so output is M (12).

One of the benefits of this type of cipher is that, unlike a Caesar cipher, it can't be broken using normal letter-frequency analysis, since the cipher-letter that represents each actual letter is not constant throughout.

I know very little about ciphers, so I'm assuming that this type of thing has been done before.

I'm curious: Does this type of cipher have a name -- and how easy is it to decipher, compared with other techniques?

share|cite|improve this question
How is the intended recipient supposed to decipher the message? – Doug Chatham Jan 20 '11 at 13:46
It can be broken by trying all 26 possibilities for the first letter. It's not really a cipher at all, but the term used to describe it in information theory is delta (en)coding. – Peter Taylor Jan 20 '11 at 13:49
I think you're missing a key here: without one you're just scrambling the text. Also, you seem to be missing directions: "G is in front of E", and "E is in front of S" - isn't there a contradiction here? How can you tell which one was used? – Kobi Jan 20 '11 at 13:51
Thanks, Peter. That answers my question! – jawns317 Jan 20 '11 at 13:57
up vote 1 down vote accepted

The kind of cipher you are thinking about is called an autokey cipher. This is a polyalphabetic cipher (several encryption rules) in which the first (possibly first few) encryptions are based on some agreed-upon rule, and later encryptions are based on the text being encrypted.

The idea was originated by Girolamo Cardano (1501-1576): he would encrypt the first word of the message using a fixed key, and then for each following word he would use the first letter of the previous word as the key for encrypting the next word.

In your case, you have a collection of Caesar ciphers (alphabetic shifts), and you are selecting which Caesar cypher to use at any given step on the basis of the previous letter in the message.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.