Caesars Cipher, solution 3 - why % 26?

Please check solution 3 on this link. I understand how the remainder of a number by a divisor maps that number to a range of [0 , divisor - 1] but somewhere the explanation says:

Now let us consider mapping a range of 26 numbers i.e. between [ 65 - 90 ] which represents uppercase [ English alphabets ] in Unicode character set to a range of numbers between [ 0 - 25 ].

Why on earth should we map the code of our alphabet to a range of [0 - 25]. What’s the reason, what’s the idea? And why adding that remainder to 65 (code of letter ‘A’) gives us the desired character code?

0 to 25 are the values that using % 26 will give us. Adding 65 is necessary because in unicode 65 is “A”.

The alphabet has 26 letters, hence [0,25], but I’m not sure if that was really your question.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.