0% found this document useful (0 votes)
18 views

Cryptography

Uploaded by

veeram
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Cryptography

Uploaded by

veeram
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CRYPTOGRAPHY

Cryptography: Cryptography is the study of methods of sending messages in disguised


form so that only the intended recipients can remove the disguise and read the
message.

Cipher Text: The message we want to send is called the plain text and the disguised
message is called the cipher text.

Enciphering or encryption: The process of converting a plain text to a ciphertext is


called enciphering or encryption.

Deciphering or decryption: The process of converting a cipher text to a plain text is


called deciphering or decryption.

Message Units: The plain text and cipher text are broken up into message units. A
message unit might be a single letter, a pair of letters (digraph), a triple of letters
(trigraph), or a block of 50 letters.
Enciphering transformation: An enciphering transformation is a function that takes any
plaintext message unit and gives us a ciphertext message unit. In other words, it is a
map 𝑓 from the set P of all possible plaintext message unit to the set 𝐶 of all possible
ciphertext message units. We shall always assume that 𝑓 is a 1-to-1 correspondence.
Deciphering transformation: Deciphering transformation is the map f −1 which goes
back and recovers the plaintext from the ciphertext.

Cryptosystem: We can represent the situation schematically by the diagram


𝑓 𝑓−1
𝑃 → 𝐶 → 𝑃.
Any such set-up is called a cryptosystem.

Example 1. Suppose we are using the 26-letter alphabet A-Z with numerical
equivalents 0-25. Let the letter 𝑃 ∈ {0,1, … , 25} stands for a plaintext message unit.
Define a function 𝑓 from the set {0,1, … ,25} to itself by the rule
𝑃 + 3 𝑖𝑓 𝑃 < 23
𝑓 (𝑃 ) = {
𝑃 − 23, 𝑖𝑓 𝑃 ≥ 23.
In other words, 𝑓 simply adds 3 modulo 26: 𝑓(𝑃) ≡ 𝑃 + 3 𝑚𝑜𝑑 26.

To encipher the word “YES” we first convert to numbers 24 4 18, then add 3 modulo
26: 1 7 21, then translate back to letters: “BHV”.

To decipher a message, one subtracts 3 modulo 26. For example, the ciphertext “ZKB”
yields the plaintext “WHY”. This cryptosystem was apparently used in ancient Rome
by Julius Caesar, who supposedly invented by himself.
Shift transformation: This example can be generalized as follows. Suppose we are
using an N-letter alphabet with numerical equivalents 0,1, … , N − 1. Let b be a fixed
integer. By a shift transformation we mean the enciphering function defined by the rule
𝐶 = 𝑓 (𝑃) = 𝑃 + 𝑏 𝑚𝑜𝑑 𝑁. Julius Caesar’s cryptosystem was the case 𝑁 = 26, 𝑏 = 3. To
decipher a ciphertext message unit 𝐶 ∈ {0,1, … , 𝑁 − 1}, we simply compute 𝑃 =
𝑓 −1 (𝐶 ) ≡ 𝐶 − 𝑏 𝑚𝑜𝑑 𝑁.

Cryptanalysis: Now suppose that you are not privy to the enciphering and
deciphering information, but you would nevertheless like to be able to read the coded
messages. This is called breaking the code, and the science of breaking codes is called
cryptanalysis.

In order to break a cryptosystem, one needs two types of information. The first is the
general nature (the structure) of the system. The second type of information is knowledge
of a specific choice of certain parameters connected with the given type of cryptosystem.

Example 2. (Frequency Analysis). Suppose that we have already intercepted a long


string of ciphertext, say several hundred letters. We know that “E” is the most
frequently occurring letter in the English language. So it is reasonable to assume that
the most frequently occurring letter in the ciphertext is the encryption of E. Suppose
that we find that “U” is the most frequently occurring character in the ciphertext. That
means that the shift takes E = 4 to U=20. That is 20 ≡ 4 + b mod 26, so that 𝑏 = 16. To
decipher the message, then it remains for us to subtract from the numerical
equivalents of "𝐹𝑄𝑂𝐶𝑈𝐷𝐸𝑀":
FQOCUDEM = 5 16 14 2 20 3 4 12 → 15 0 24 12 4 13 14 22 = PAYMENOW
Affine map: A general type of transformations of 𝑍/𝑁𝑍, called an affine map: 𝐶 ≡ 𝑎𝑃 +
𝑏 𝑚𝑜𝑑 𝑁, where 𝑎 and 𝑏 are fixed integers.

Illustration: For example, working again in the 26-letter alphabet, if we want to


encipher our message “PAYMENOW” using the affine transformation with
enciphering key 𝑎 = 7, 𝑏 = 12, we obtain: 15 0 24 12 4 13 14 22 →
13 12 24 18 14 25 6 10 = "NMYSOZGK".

To decipher a message that was enciphered by means of the affine map 𝐶 ≡ 𝑎𝑃 +


𝑏 𝑚𝑜𝑑 𝑁, one simply solve for 𝑃 in terms of 𝐶, obtaining 𝑃 ≡ 𝑎′ 𝐶 + 𝑏′ 𝑚𝑜𝑑 𝑁, where 𝑎′
is the inverse of 𝑎 modulo 𝑁 and 𝑏′ is equal to −𝑎−1 𝑏. Note that this works only if
gcd(𝑎, 𝑁) = 1.
To summarize, an affine cryptosystem in an 𝑁 −letter alphabet with parameters 𝑎 ∈
𝑧/𝑁𝑍 ∗and 𝑏 ∈ 𝑍/𝑁𝑍 consists of the rules: 𝐶 ≡ 𝑎𝑃 + 𝑏 𝑚𝑜𝑑 𝑁, 𝑃 ≡ 𝑎′ 𝐶 + 𝑏′ 𝑚𝑜𝑑 𝑁,
where 𝑎′ = 𝑎−1 and 𝑏′ = −𝑎−1 𝑏.

Special cases: As a special case of the affine crypto systems, we can set 𝑎 = 1, thereby
obtaining the shift transformation.

Another special case is when 𝑏 = 0; 𝑃 ≡ 𝑎𝑐 𝑚𝑜𝑑 𝑁, 𝐶 ≡ 𝑎−1 𝑃 𝑚𝑜𝑑 𝑁. The case 𝑏 = 0 is


called a linear transformation, meaning that the map takes a sum to a sum, that is, if 𝐶1
is the encryption of 𝑃1 and 𝐶2 is the encryption of 𝑃2 , then 𝐶1 + 𝐶2 is the encryption of
𝑃1 + 𝑃2 .

Digraph transformation: We now suppose that our plain text and ciphertext message
units are two-letter blocks, called digraphs. This means that the plaintext is split up
into two-letter segments. If the entire plaintext has an odd number of letters, then in
order to obtain a whole number of digraphs we add on an extra letter at the end; we
choose a letter which is not likely to cause confusion, such as a blank if our alphabet
contains a blank, or else "X" or "Q" if we are using just the 26-letter alphabet.

Each digraph is then assigned a numerical equivalent. The simplest way to do this is
to take 𝑥𝑁 + 𝑦, where 𝑥 is the numerical equivalent of the first letter in the digraph, 𝑦
is the numerical equivalent of the second letter in the digraph, and 𝑁 is the number of
letters in the alphabet. Equivalently, we think of a digraph as a 2-digit base 𝑁 integer.
This gives a 1-to-1 correspondence between the set of all digraphs in the 𝑁- letter
alphabet and the set of all nonnegative integers less than 𝑁 2 .

Next, we decide upon an enciphering transformation, that is, a rearrangement of the


integers {0, 1, … , N 2 − 1}. Among the simplest enciphering transformations are the
affine ones, where we view this set of integers as Z/N 2 𝑍, and define the encryption of
P to be the nonnegative integer less than N 2 satisfying the congruence C ≡ aP +
b mod N 2 . Here, as before, 𝑎 must have not common factor with N, in order that we
have an inverse transformation telling us how to decipher: P ≡ a′ C + b′ 𝑚𝑜𝑑 𝑁 2 , where
a′ ≡ a−1 𝑚𝑜𝑑 𝑁 2 , 𝑏′ ≡ −𝑎−1 𝑏 𝑚𝑜𝑑 𝑁 2 . We translate C into a two-letter block of
ciphertext by writing it in the form C = x ′ N + y′, and then looking up the letters with
numerical equivalents x′ and y′.

Example: Suppose we are working in the 26-letter alphabet and using the digraph
enciphering transformation C ≡ 159P + 580 mod 676. Then the digraph "NO" has
numerical equivalent 13 ⋅ 26 + 14 = 352 and is taken to the ciphertext digraph 159 ⋅
352 + 580 ≡ 440 mod 676, which is "QY". The digraph "ON" has numerical equivalent
377, and is taken to 359 = "NV". Notice that the digraphs change as a unit, and there
is no relation between the encryption of one digraph and that of another one that has
a letter in common with it or even consists of the same letters in the reverse order.

Example. You know that your adversary is using a cryptosystem with a 27-letter
alphabet, in which the letters A-Z have numerical equivalents 0-25 and blank=26. Each
digraph then corresponds to an integer between 0 and 728 = 272 − 1 according to the
rule that, if the two letters in the digraph have numerical equivalents 𝑥 and 𝑦, then the
digraph has numerical equivalent 27x + y, as explained earlier. Suppose that a study
of a large sample of ciphertext reveals that the most frequently occurring digraphs are
in order “ZA”, “IA”, and “IW”. Suppose that the most common digraphs in the
English language are “E”, “S”, “T”. You know that the cryptosystem uses an affine
enciphering transformation modulo 729. Find the deciphering key, and read the
message “NDXBHO”. Also find the enciphering key.
Solution. We know that plaintexts are enciphered by means of the rule C ≡ aP +
b mod 729, and that ciphertexts can be deciphered by means of the rule P ≡ a′ C +
b′ 𝑚𝑜𝑑 729; here a, b form the enciphering key, and a′ , b′ form the deciphering key. We
first want to find a′ and b′. We know how three digraphs are deciphered, and, after
we replace the digraphs by their numerical equivalents, this gives us the three
congruences:

675𝑎′ + 𝑏′ ≡ 134 𝑚𝑜𝑑 729,


216a′ + b′ ≡ 512 mod 729,
238a′ + b′ ≡ 721 mod 729.
If we try to eliminate b′ by subtracting the first two congruences, we arrive at 459𝑎′ ≡
351 𝑚𝑜𝑑 729, which does not have a unique solution a′ 𝑚𝑜𝑑 729. We do better if we
subtract the third congruence from the first, obtaining 437a′ ≡ 142 mod 729. To solve
this, we must find the inverse of 437 modulo 729. By way of review of the Euclidean
algorithm, let’s go through that in detail:
729 = 437 + 292
437 = 292 + 145
292 = 2 ⋅ 145 + 2
145 = 72 ⋅ 2 + 1
and then

1 = 145 − 72 ⋅ 2
= 145 − 72(292 − 2 ⋅ 145)
= 145 ⋅ 145 − 72 ⋅ 292
= 145(437 − 292) − 72 ⋅ 292
= 145 ⋅ 437 − 217 ⋅ 292
= 145 ⋅ 437 − 217(729 − 437)
≡ 362 ⋅ 437 𝑚𝑜𝑑 729.
Thus a′ ≡ 362 ⋅ 142 ≡ 374 mod 729, and then b′ ≡ 134 − 675 ⋅ 374 ≡ 647 mod 729.
Now applying the deciphering transformation the digraphs “ND”, “XB” and “HO” of
our message – they correspond to the integers 354, 622 and 203, respectively – we
obtain the integers 365, 724 and 24. Writing 365 = 13 ⋅ 27 + 14, 724 = 26 ⋅ 27 +
22, 24 = 0 ⋅ 27 + 24, we put together the plaintext digraphs into the message “NO
WAY”. Finally, to find the enciphering key we compute a ≡ a′(−1) ≡ 374−1 ≡
614 𝑚𝑜𝑑 729 and b ≡ −a′(−1) 𝑏′ ≡ −614 ⋅ 647 ≡ 47 𝑚𝑜𝑑 729.
Enciphering Matrices.
Suppose we have an N- letter alphabet and want to send digraphs (two-letter blocks)
as our message units. In previous section we saw how we can let each digraph
correspond to an integer considered modulo N 2 , that is, to an element of 𝑍/𝑁 2 𝑍. An
alternate possibility is to let each digraph correspond to a vector, that is, to a pair of
integers (𝑥𝑦) with x and y each considered modulo N. For example, if we’re using the
26-alphabet A − Z with numerical equivalents 0 − 25, respectively, then the digraph
NO corresponds to the vector (13
14
).

Linear Algebra modulo N. The matrix A has an inverse matrix given by the same
formula as in the real case:
−1
A−1 = ( 𝐷 −1𝑑 −𝐷−1 𝑏)
−𝐷 𝑐 𝐷−1 𝑎
𝑎 𝑏
Where A = ( ) and D = ad − bc.
𝑐 𝑑

You might also like