Cryptography Reference
In-Depth Information
(here, the notation 'mod 26' means that the remainder of integer division by 26 is
taken).
It is then easy to check that Dec
∈ Z 26 , so that we have
indeed defined a symmetric encryption scheme except for one thing: we have not
defined the key generation algorithm. In the case of classical ciphers this algorithm
was usually left unspecified, which is very dangerous regarding security. An extreme
example of this is provided by Caesar himself who, according to Suetonius, used the
fixed value k
(
k
,
Enc
(
k
,
i
)) =
i for i
,
k
3 as key. This is not very important in this case because, as shown
below, the cipher is extremely easy to break anyway. However, even if the cipher
were strong in other aspects, using a fixed key would make it very weak. The sensible
way to choose keys is to do it uniformly at random, which means that all keys have
the same probability of being chosen. In the following we will assume that, unless
otherwise specified, keys are chosen this way.
Observe that we are not restricted to encrypting only one-letter plaintexts because
any string of text can be encrypted by concatenating the encryptions of individual let-
ters and the same applies when decrypting a ciphertext. Observe also that, once a key
k has been chosen, the Caesar cipher merely encrypts a text string by shifting—hence
the name 'shift cipher'—each character k positions to the right, i.e., by replacing it
by the one which is located k positions to the right in the alphabet (here a cyclic
shift is used, in the sense that when one arrives at the last letter one goes back to the
first; this cyclic shifting corresponds to the operation of adding k (modulo 26) to an
element of
=
Z 26 ). The decryption function merely undoes this by shifting the letter k
positions to the left.
As a first, easy example, suppose that we want to encrypt the word 'caesar' using
the Caesar cipher over the English alphabet (with lower case letters only) with k
=
3.
We obtain Enc 3 (
caesar
) =
fdhvdu and, of course, Dec 3 (
fdhvdu
) =
caesar (here
we use the shorter form Enc k instead of Enc
(
k
, )
and similarly for decryption).
Example 1.1 Maple has an implementation of the Caesar cipher in the functions
Encode and Decode of the package StringTools .Wefirstload StringTools
using the with command, which makes all the functions in the package immedi-
ately accessible by just keying in their name. Then, to encrypt a text string over
the English alphabet, we use the command Encode(string, encoding =
alpharot[n]) , where n is an integer in the 0
25 range 1
..
(i.e., the key for the
Caesar cipher). For example, we have:
> with(StringTools):
> Encode("caesar", encoding = alpharot[3]);
"fdhvdu"
> Decode("fdhvdu", encoding = alpharot[3]);
"caesar"
There is a variant of the above functions that performs a cyclic shift modulo 256
over the 8-bit ASCII (or ISO Latin 1) code using the format Encode(string,
1 Here and in the sequel we use Maple's notation for an integer range.
Search WWH ::




Custom Search