6

The only time a shift cipher considers to be perfectly secure is when used on a single letter of plaintext and no more. Having that in mind, we can say it is certainly not perfectly secure.

Caesar cipher is perfectly secret only in the special case with the assumption that 26 keys are used in equal probability. Suppose that we have a plaintext of 50 characters long if each key for each character is chosen equiprobably then you end with 26^50 possible keys.

That is my answer, is it correct?

kelalaka
  • 49,797
  • 12
  • 123
  • 211
whitehat.c
  • 63
  • 1
  • 5

2 Answers2

24

Yes, because instead of a Caesar cipher you now have a One-time pad. In particular, it meets the requirements of a key that is random and as long as the message. So as long as the key is kept secret and never used for another message, you have OTP security.

Eugene Styer
  • 1,699
  • 1
  • 12
  • 15
18
  1. What you described it not a Caesar cipher. A Caesar cipher is a cipher where all letters are shifted by the same number of positions. In the question text you are describing a shift cipher. This is the right wording.

  2. What you described is an OTP. I agree with Eugene Styer's answer. If the letters for the key are taken from the same set (26 letters), and the generator is uniformly random, then you get an OTP.

And don't agree with kelalaka's answer that the key should be defined on the bits. If you don't respect the number of letters in the set and take 5 bits = 32 key values, then the letters of the original message will be moved not uniformly. $(P + K) \mod 26$ will produce not uniform output, because the probability that (P + K) mod 26 = P (or P+1 ... P+5) is twice the probability of P+6 ... P+25. When we consider any letter X in the encrypted message, then the probability that the original letter is one of {X-5, X-4, X-3, X-2, X-1, X} is 2/32, and the probability for other letters is 1/32.

Thus, if you implement it on bits, as kelalaka suggests, it will not be an OTP. If the letters for the key are taken from the same set, i.e. 26 letters (or 26 consecutive numbers), this is exactly what you described, then it will be an OTP.

Deduplicator
  • 103
  • 3
mentallurg
  • 2,661
  • 1
  • 17
  • 24