Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. 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

If you consider a 26 letter alphabet, and a cipher where 24 of the letters are sent to themselves, and only 2 letters switch, how many different substitution alphabet ciphers are there, and what percentage are they of total possible?

I thought it would be there are $26\cdot25=650$ such possible ciphers, for a percentage of $$\frac{26\cdot25}{26!}\cdot100\approx1.61\cdot10^{-22}\%$$

But it seems there are only $325$ possible ciphers, when switching only two letters, and i dont understand why?

share|improve this question
Hint: Try that calculation with a 2 letter alphabet where 0 of the letters are sent to themselves. $\hspace{.79 in}$ – Ricky Demer Jun 2 '14 at 23:38
If $\Sigma=\{a,b\}$ then wouldnt you have only one possible cipher combination? I feel like something should have clicked from that, but it didnt nor as i try to think of smaller cases now... – Finding Nemo 2 is happening. Jun 3 '14 at 1:13
up vote 3 down vote accepted

Iterate through the alphabet (using a smaller alphabet is always a good way to start). So you take letter A and you can combine it with letter B..Z. Now if you take B, then you can combine it with letter A and C..Z. But the combination (A,B) is equivalent to (B,A). So you only have C..Z to consider. Thus you would get (n - 1) + (n - 2) + ... pairs, leaving you with 26 * (25 / 2) = 325 combinations.

share|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.