Docsity

Introduction to Cryptography and Coding Devices, Study notes of Number Theory

Toggle sidebar
bg1
V55.0106 Quantitative Reasoning: Computers, Number Theory and Cryptography
4 Cryptography
LOBBY VULTM XYQBB UWZGY QVTTB RYVZU VQZEB XZDNV KKQHI BKBHO UBWBU ZDLQY
ZWBRZ WBYQV TPBTT HLBNV YQZDY YZZPD RQYOZ DMKBV YVTRZ WBWDT VULHU HGGVU
BRZWB TZVYV THTVP EKBTD MTYVY DYVZU RZWBT VURBV YVTEO BTBUY BWVUM KZRFT
ZGGVI BVYTQ HOWBO YZWBR ZWBYQ BGVOT YEBOT ZUVUY QBRKH TTNQZ WBRZW BTVYH
UWUZY VGVBT PBMXB PHVKL BYTHT EBRVH KEOVC B
A message such as this is meant to appear as a meaningless jumble to most anyone who reads
it. It is a simple message coded in a simple way. In this section, we shall learn different ways
to code messages, and some approaches used to decode them.
Cryptography is a discipline which concerns itself with communication secrecy. Coded mes-
sages have long been used by businesses, governments and the military, and for obvious
reasons. If you want to send a message to a friend or partner, you do not want it to under-
stood by everyone who intercepts that message. Even before the advent of the computer, and
the possibility of sending (and intercepting) electronic messages, it was well understood that
some coding device was necessary to insure secrecy from “the enemy” who might intercept
messages.
With the advent of the computer, issues of secrecy have come closer to home, because elec-
tronic interception (snooping) has become commonplace, and much easier. When ordering
on the Internet, and you give your credit card number, you do not want any intruder to find
it. So responsible companies who do business on the Internet must use very sophisticated
coding systems to keep this information secret from intruders. In this section we consider
some of the methods used to code and decode messages.
For simplicity in our treatment, we shall start by sending with messages using the 26 letters
A through Z. Thus, we omit small letters, punctuation, spaces, and even numerals. It is
convenient to assign numbers to these letters, and the most natural numbering is given in
the following table.
Letter A B C D E F G H I J K L M
Number 1 2 3 4 5 6 7 8 9 10 11 12 13
Letter N O P Q R S T U V W X Y Z
Number 14 15 16 17 18 19 20 21 22 23 24 25 0
35
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Introduction to Cryptography and Coding Devices and more Study notes Number Theory in PDF only on Docsity!

V55.0106 Quantitative Reasoning: Computers, Number Theory and Cryptography

4 Cryptography

LOBBY VULTM XYQBB UWZGY QVTTB RYVZU VQZEB XZDNV KKQHI BKBHO UBWBU ZDLQY

ZWBRZ WBYQV TPBTT HLBNV YQZDY YZZPD RQYOZ DMKBV YVTRZ WBWDT VULHU HGGVU

BRZWB TZVYV THTVP EKBTD MTYVY DYVZU RZWBT VURBV YVTEO BTBUY BWVUM KZRFT

ZGGVI BVYTQ HOWBO YZWBR ZWBYQ BGVOT YEBOT ZUVUY QBRKH TTNQZ WBRZW BTVYH

UWUZY VGVBT PBMXB PHVKL BYTHT EBRVH KEOVC B

A message such as this is meant to appear as a meaningless jumble to most anyone who reads it. It is a simple message coded in a simple way. In this section, we shall learn different ways to code messages, and some approaches used to decode them.

Cryptography is a discipline which concerns itself with communication secrecy. Coded mes- sages have long been used by businesses, governments and the military, and for obvious reasons. If you want to send a message to a friend or partner, you do not want it to under- stood by everyone who intercepts that message. Even before the advent of the computer, and the possibility of sending (and intercepting) electronic messages, it was well understood that some coding device was necessary to insure secrecy from “the enemy” who might intercept messages.

With the advent of the computer, issues of secrecy have come closer to home, because elec- tronic interception (snooping) has become commonplace, and much easier. When ordering on the Internet, and you give your credit card number, you do not want any intruder to find it. So responsible companies who do business on the Internet must use very sophisticated coding systems to keep this information secret from intruders. In this section we consider some of the methods used to code and decode messages.

For simplicity in our treatment, we shall start by sending with messages using the 26 letters A through Z. Thus, we omit small letters, punctuation, spaces, and even numerals. It is convenient to assign numbers to these letters, and the most natural numbering is given in the following table.

Letter A B C D E F G H I J K L M Number 1 2 3 4 5 6 7 8 9 10 11 12 13

Letter N O P Q R S T U V W X Y Z Number 14 15 16 17 18 19 20 21 22 23 24 25 0

Note that we have assigned Z the number 0, rather than 26. This is because we shall work modulo 26–with remainders when we divide by 26–so it is most convenient to use the numbers from 0 through 25. (Computer scientists usually start labeling A as 0, etc. but we have avoided this, since most of us have learned that A is the first letter, B the second, etc.) It will be useful to learn this table. I find the simplest way is to know that the numbers 5, 10, 15, 20, and 25 correspond to E, J, O, T, and Y. If you know your alphabet, the rest is easy.

Shift Substitutions. A very simple coding device is to replace every letter by the letter two positions after it. Thus, A is replaced by C, B by D, and so on. When we come to Y, we replace it by A (going around the circle). Similarly, replace Z by B. Thus, the message

STAY RIGHT THERE FOR NOW

will be coded as

UVCA TKIJV VJGTG HQT PQY or UVCAT KIJVV JGTGH QTPQY

since it is customary in coding to give the message in groups of 5 letters. (The spaces between words may give clues as the possible meanings.) Such a code was used by Julius Caesar, and so it has a long history.

The person who receives the message UVCAT KIJVV JGTGH QTPQY and who knows the coding device will replace each letter by the letter two before it. The result is of course:

STAYR IGHTT HEREF ORNOW

The words can now easily be separated and the message is decoded.

The original message is called the plaintext; the coded version is called the ciphertext. The process of changing plaintext into ciphertext is called coding or encryption. The process of changing ciphertext back into plaintext is called decoding or decryption. Encryption and decryption can be done if you are privy to the method used. If you have intercepted a message in ciphertext, and you want to find its plaintext meaning, but you don’t know the decryption method, you must use the art of cryptanalysis to find the plaintext. This will be considered in what follows.

The encryption above can be given by a simple mathematical formula. Coding A as C, B as D, etc. is described numerically as coding 1 as 3, 2 as 4, 3 as 5, etc. Just add 2. If the plaintext number is p and the corresponding ciphertext number is c, then this code is simply c = p + 2. However, this formula falls apart for X (24), Y (25) since 24 + 2 = 26, and 25 + 2 = 27. But the formulas will be valid if we work with the remainders when divided by

mod 26, and the encryption formula is c ≡ p + 5 mod 26. The ciphertext is thus obtained by shifting 5 to the right, and so deciphering shifts 5 to the left: p ≡ c − 5 mod 26. Now work letter by letter. Y’s number is 25. Here c = 25 so p ≡ 25 − 5 = 20, so the plaintext corresponding to Y is T. The letter D, has c = 4, so here p ≡ 4 − 5 = − 1 ≡ 25 (adding 26 to −1). Thus the plaintext for D is Y. Proceeding this way, we decode this messages as THEYA REHER E, or adjusting spaces: THEY ARE HERE.

For additive ciphers given by Equation (5), the entire code is known, once we know the single number a. This number is called the key for this coding. Obviously, when you know the key, coding and decoding is simple. Another usage, will come in handy, is to let the key be the ciphertext corresponding to the plaintext A. So for a shift of a = 2, we can speak of the key 2, or equivalently, the key C. Similarly, a shift code with key letter G will have a = 6.

While shift codes can be easily use for coding, they have a severe limitation. Since they are all of the form c ≡ p + a mod 26, there are only 25 encipherings of this type available corresponding to a = 1 to 25. (Of course, a = 0 amounts to no coding at all, or the trivial coding.) If you know that a shift code is being used, all you would have to do is to try the 25 different values of a and the decoding of a message can be done. This can be done fairly easily by hand. And with the right computer program, all 25 possible decodings of a message can be done almost instantaneously.

All shift codes are given on page 51. It is convenient to use this table for shift codes. The first line, the usual alphabet, is the plaintext line. Each line following represents a different shift a, for a = 1 to 25. For example, the line starting with D is the shift code with key letter D, corresponding to a = 3.

We can rework Example 1 easily using this table. Since E is enciphered as J. look under E until you find J. This will be in the row starting with F. So the code used had key F (A→F). Now take the message YMJDF WJMJW J and read these letters on row F. The plaintext will be right above each letter in the first row. This easily yields THEYA REHER E as before and with a lot less fuss.

Affine Codes. An affine code, described in what follows, is a coding scheme where the letters are more mixed up than in a shift code. For simplicity, we shall illustrate using a truncated alphabet of 10 letters A through J. Suppose the plaintext A is coded as the ciphertext D. But now we code B as G^1 (3 beyond D) as in the diagram:

Plain A B C D E F G H I J Cipher D G

Now continue by assigning C to J (three beyond G: H, I, J), D to C (three beyond J: A, B,

(^1) In a shift code, we would code B as E, C as F, etc.

C)^2 , E to F (3 beyond C: D, E, F), etc., completing the table:

Plain A B C D E F G H I J Cipher D G J C F I B E H A

We can decode in this theoretical example by reversing the cipher and the plaintext rows. For simplicity, we can alphabetize the cipher row to obtain:

Cipher A B C D E F G H I J Plain J G D A H E B I F C

Reading directly from the first table, we can code the message BID HIGH into GHC EHBE. Reading from the second table, see if you can decode the message GDCCH JF.^3

How is this done algebraically with the full 26 letter alphabet? Suppose we use the same scheme for 26 letters, coding A as D, B as G (3 beyond D), C as J (3 beyond G) etc. In this case, the formula relating p (plaintext) and c (ciphertext) is

c ≡ 3 p + 1 mod 26, 0 ≤ c ≤ 25 (6)

Note how the factor 3 in this formula has the intended effect. The following table shows this:

p 1 2 3... c = 3p + 1 4 7 10...

The factor 3 increases each value of c by 3 for every one increase in p. The constant 1 was chosen so that p = 1 (A) corresponded to c = 4 (D).

Let’s use this formula to code the message GOOD LUCK. The work is done in the following table. The table has only one of the O’s in this message.) Use a calculator to do this calculation. It can also be done on a spreadsheet.

plaintext p c = 3p + 1 c mod 26 ciphertext G 7 22 22 V O 15 46 20 T D 4 13 13 M L 12 37 11 K U 21 64 12 L C 3 10 10 J K 11 34 8 H (^2) After J comes A. We go around in a circle (^3) You should get BAD DICE.

ambiguous. In this case, each of the odd numbered letters, A, C, E, etc. as ciphertext, would have two corresponding plaintext letters, while the even numbered letters B, D, etc would have none. The general rule is that we must choose a so that it has no common factors with 26: GCD(a,26)=1. Thus there are the following 12 possibilities for a:

a = 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25

If formula (8) is used as a code, it would be natural to call the pair (a, b) as the key. Another possibility is to use the ciphertext of the plaintext AB. Thus, the formula c ≡ 5 p + 7 would have key (5,7) or key LQ. Do you see why?

Example. The message

YDCUZYP RLX AFOZMFSFA

is received. It is known that the cipher used was an affine cipher with equation c ≡ 5 p + 7 mod 26. What was the original message?

Method: We solve c ≡ 5 p + 7 mod 26 for p. Multiply by 5.^5 Working mod 26, this gives 5 c ≡ 25 p + 35 ≡ −p + 9. Solving, p ≡ − 5 c + 9 mod 26.

For example, to decode the first letter Y, we first find its cipher number c = 25 ≡ −1. Therefore p ≡ − 5 c + 9 = (−5)(−1) + 9 = 14. So the plaintext letter is N. Continuing in this fashion, the reader is welcome to discover the full text.

As we have seen, the algebraic problem of decoding an affine code involves solving a linear congruence. This is an equation of the form ax ≡ b mod n. In all of our problems, we shall assume that a and n have no common factor. So, as above when n = 26, we arrange for a to be between a and 25, odd, and not 13. We cannot solve the congruence ax ≡ b mod 26 by dividing by a, since we only use integers when working mod 26, and do not allow fractions. However, a systematic way of solving the equation ax ≡ b mod 26 is to multiply this equation by some number b for which ab ≡ 1 mod 26. Such a number b is called the inverse of a mod

  1. For example, the inverse of 3 mod 26 is 9, since 3 · 9 = 27 ≡ 1 mod 26. A quick check shows the following table of inverses mod 26 for the above 12 numbers.

Number 1 3 5 7 9 11 15 17 19 21 23 25 Inverse 1 9 21 15 3 19 7 23 11 5 17 25

There is a handy way of remembering this table. Listing all the numbers with their inverses, we have (1,1), (3,9), (5,21), (7,15), (11,19), (17,23), and (25,25). Recalling that −c ≡ (^5) In this case, the idea is to get the coefficient of p congruent to −1 mod 26.

26 − c mod 26, these can be written as (1,1), (3,9), (5,−5), (7,15), (− 15 , −7), (− 9 , −3), and (− 1 , −1). So a short list is simply:

Here, we simply have to remember that we can multiply each term of the pair by −1 to get another pair. And remember the numbers in the pairs are inverses: the product of the two numbers in a pair is 1, mod 26. In what follows, we shall refer to this short list.

Example: An affine code is given by the equation c ≡ 21 p + 17 mod 26. Solve for p to find the decoding formula.

Method: Write the equation as c ≡ − 5 p − 9 mod 26. (Subtraction 26 keeps the numbers the same mod 26.) Since (5, −5) is in the short list, 5 and −5 are inverses, and we multiply by 5. This gives 5c ≡ p − 45 mod 26, or p ≡ 5 c + 45 ≡ 5 c + 19.

Example: An affine code is given by the formula c ≡ 11 p + 2 mod 26. A cipher letter is P. What is the corresponding plaintext letter?

Method: Since 11 ≡ −15 mod 26, we’ll use the short list couple (7,15), but in the form (− 7 , −15). The original equation is c ≡ − 15 p + 2 mod 26. So multiply by −7 to get − 7 c ≡ p − 14 mod 26, or p ≡ − 7 c + 14 mod 26. In this example, the cipher letter was P, and so c = 16. Therefore p ≡ − 7 c + 14 = −98 mod 26. Since − 98 ≡ 6 mod 26^6 , we have p = 6, and so the plaintext letter is F.

Example: Solve for x: 13x ≡ 5 (mod 100)

Method: We don’t have a short list for inverses mod 100, so we proceed as follows. Multiply by 7, bringing the coefficient of x to 91, or -9. This gives 91x ≡ 35 (mod 100), or − 9 x ≡ 35 (mod 100). Now multiply by 11 to get − 99 x ≡ 385 (mod 100), or x ≡ 85 (mod 100).

The appendix on page 49 gives a very effective algorithm for computing the inverse of any number modulo another, provided the GCD of these numbers is 1. A spreadsheet method will be given in he lab.

It is worth mentioning at this time that we have used congruences to nicely mix up the letters of the alphabet. This is yet another example of a mathematical curiosity put to a practical use.

General Substitution Codes.

The additive and, more generally, affine codes each give simple ways to rearrange the letters (^6) We added 104 = 4 · 26 to −98 to get 6.

These all involve substitution codes, which might be randomly generated, and so cannot be as easily broken as an affine code. How can these be cracked?

Based on observations and careful analysis of texts, it has been observed that for an average English text, the letter E is repeated by far the most times, and that after that, in order, the letters T, A, O, I, N, S, H, R are repeated with high frequencies. The following interesting table^9 gives the approximate relative frequencies of the 26 letters. Of course, these are statistical averages, and we can never expect exactly these results in any specific text.

Group Letter Frequency of Group(%) Range of individual frequencies 1 E 12.7% 12+% 2 T,A,O,I,N,S,H,R 56.9% 6%-9% 3 D,L 8.3% 4% 4 C,U,M,W,F,G,Y,P,B 19.9% 1.5%–3% 5 V,K,J,X,Q,Z 2.2% Less than 1%

Thus, for a large enough ciphertext using a substitution code, one way of breaking the code would be to make a frequency count of its letters, expecting the most frequent, (or next most frequent) letter to be E, and the next frequent letters to be in the second group. For example, in the first paragraph of this section (which was written innocently without regard to which letters were being used) exactly 468 letters were used. The eight letters used most, with the percentage of times they were used were as follows:

Letter Count Percentage E 65 13. S 42 9. O 39 8. T 38 8. N 37 7. I 30 6. A 28 6. R 26 5.

Note that E (group 1) led the list, and the remaining 7 were all in group 2. This observation gives us a method to decipher a ciphertext: Simply count frequencies and see what happens if the letter with the largest frequency decodes as E, or perhaps T.^10

Let us illustrate how a frequency count can help decode a message. For simplicity, we assume that the code is a shift code. The message is

(^9) Taken from Cryptology, by Albrecht Beutelspacher, The Mathematical Association of America, 1¸994. (^10) Poe’s short story, The Gold Bug uses this method as a crucial part of the story. In this story, E is said

to have the largest frequency, but T comes much lower than second in his list.

BPQAK WLMQA DMZGM IAGBW JZMIS

A frequency count gives the following table:

Letter Count Percentage M 4 16 A 3 12 B,G,I,Q,W,Z 2 8

We suspect that E is coded as M, the most frequent letter. There’s no guarantee, of course, because the size of the message is relatively small. However, if this so, and we have a shift code of the form c = p + a, we should have plaintext E (p = 5) correspond to ciphertext M (c = 13. Thus, 13 = 5 + a, and the key is a = 8, or key letter I. To decode, we use p = c − a = c − 8. The decoded message is

THISC ODEIS VERYE ASYTO BREAK

or simply THIS CODE IS VERY EASY TO BREAK. Frequency analysis saved us from trying the 25 different possible shift codes. If a = 8 didn’t work we would next have tried a = −4 (in order to have E be coded as A) in the hope that this worked.

It is possible to use more than letter frequency to decode substitution codes. For a long code, we can count frequency of pairs or triples of letters. Thus, the pair TH is common in English (THE, THERE, THEY), as well as HE (as in THE, THERE, SHE), and high frequency of pairs can be further used to break the code. We shall not do this in these notes.

Frequency counts of texts, as well as coding and decoding affine or shift codes can be easily done on the computer, and programs to do this will be available in the lab.

Because of frequency considerations of this sort, few people would want to use a substitution code for a relatively long and important message. It would be fairly easy to decipher. Another problem with substitution codes is that if they are created randomly, the receiver of the ciphertext must know the entire code, and this can be cumbersome. Compare this with an affine code, in which the receiver must know only two numbers (the values a and b).

Vigen`ere Ciphers.^11 When using a shift code, the person who is receiving the message must know the shift in order to decode. This could be any single letter as indicated above. For example, the letter J would correspond to the shift code in which plaintext A corresponds to ciphertext J, and which corresponds to a = 9. This in turn corresponds to the row J on

(^11) Named after a French diplomat.

work with the 26 letters again, and take the plaintext “BEWARE THE IDES OF MARCH”:

BEWARETHEIDESOFMARCH

Now break into blocks of two to get

BE WA RE TH EI DE SO FM AR CH

Take the original numerical codes A→1, B→ 2, and write this plaintext numerically using two digits–B→ 02, E→ 05, W→23, etc.:

We now have 4 digit numbers representing these pairs, and it is much more difficult to analyze the frequency of these pairs even for a long message. But how do we code 4 digit numbers all numbered 2525 or under? We take some number over 2525, say 2600, and then use an affine substitution modulo this number. For example, we might try

c ≡ 17 p + 1531 mod 2600 (9)

As in the simple affine substitution discussed before it is essential that the coefficient of p and the modulus 2600 have GCD 1. For 2600, this means we must avoid any a which is divisible by 2, 5, or 13. We now encode this message. (We used a spreadsheet to do the computation.)

p 17 p + 1531 c ≡ 17 p + 1531 mod 2600 205 5016 2416 2301 40648 1648 1805 32216 1016 2008 35687 1867 509 10184 2384 405 8416 616 1915 34086 286 613 11952 1552 118 3537 937 308 6767 1567

Putting in initial 0’s to keep four digits, the ciphertext is

All this is fine for the person doing the coding. But how about decoding? Presumably, a stranger picking up this message will get nowhere with it.^12 But what about our friend who knows the basic code c ≡ 17 p + 1531 mod 2600. In order to decode, it will be necessary to find the inverse of 17 mod 2600 to solve for p. It turns out that 153 is the inverse, since 17 × 153 = 2601 ≡ 1 mod 2600.^13 Therefore, we can solve equation (9) by multiplying by

  1. This gives

c ≡ 17 p + 1531 mod 2600 153 c ≡ p + 153 · 1531 ≡ p + 234243 ≡ p + 243 mod 2600 p ≡ 153 c − 243 mod 2600

For example the first block in our ciphertext is c = 2416. Computing, using p ≡ 153 c − 243 mod 2600, we get

p ≡ 153(2416) − 243 = 369405 ≡ 205 mod 2600

Of course, 205 (0205) converts back into the letter pair BE, and this is the beginning of the deciphering process.

In practice, this coding and decoding will be done on the computer, and we will set this up on the lab computer. We will only consider grouping into blocks of two, but we will also vary the coding formula, and even the modulus 2600 which was chosen arbitrarily. If the number of letters in the plaintext is odd, the last block will have only one letter. In this case, we simply add the letter X or Z to the end to make it a block of two.

We have only scratched the surface of this important topic of cryptography. Methods of coding are being developed up to the present time (as well as methods to break the code.) This section showed how number theory, especially the theory of congruences, can be of use in this process. Once again, a mathematical subject, once deemed to be interesting but utterly impractical, has become an important tool in a very practical situation.

(^12) We could confound an interceptor by grouping this code in groups of 5. Thus 24161 64810... (^13) See page 49 for a simple way to compute the inverse of a mod b.

The solution is x ≡ 1037 mod 2600. For example, the number 511 in the last column, was obtained by multiplying −34 (the negative of the quotient) by −15 (the number above it) and adding 1 (the number above that.)

Problem: A message is coded using blocks of 2, and the affine substitution c ≡ 173 p + 329 mod 2600. What is the decoding formula? How do you decode the message 1202 554?

Method: To solve this congruence, simply multiply by the inverse of 173 mod 2600. We found this to be 1037 in the above problem. Multiplying, we get 1037c ≡ 1037 · 173 p+1037· 329 mod 2600. Since 1037 · 329 = 341173 ≡ 573, this congruence becomes 1037c ≡ p + 573 mod

  1. Solving for p, we find p ≡ 1037 c − 573 mod 2600 or p ≡ 1037 c + 2027 mod 2600.

To decode the message, we use the formula p ≡ 1037 c + 2027 mod 2600 for c = 1202 and for c = 554. The results are given in the following table:

c 1037 c + 2027 mod 2600 Block equivalent 1202 1248501 501 EA 554 576525 1925 SY

The message is simply decoded as EASY.

These computations will also be done in the lab using the computer.

Table of Shift Substitutions

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

B C D E F G H I J K L M N O P Q R S T U V W X Y Z A

C D E F G H I J K L M N O P Q R S T U V W X Y Z A B

D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

E F G H I J K L M N O P Q R S T U V W X Y Z A B C D

F G H I J K L M N O P Q R S T U V W X Y Z A B C D E

G H I J K L M N O P Q R S T U V W X Y Z A B C D E F

H I J K L M N O P Q R S T U V W X Y Z A B C D E F G

I J K L M N O P Q R S T U V W X Y Z A B C D E F G H

J K L M N O P Q R S T U V W X Y Z A B C D E F G H I

K L M N O P Q R S T U V W X Y Z A B C D E F G H I J

L M N O P Q R S T U V W X Y Z A B C D E F G H I J K

M N O P Q R S T U V W X Y Z A B C D E F G H I J K L

N O P Q R S T U V W X Y Z A B C D E F G H I J K L M

O P Q R S T U V W X Y Z A B C D E F G H I J K L M N

P Q R S T U V W X Y Z A B C D E F G H I J K L M N O

Q R S T U V W X Y Z A B C D E F G H I J K L M N O P

R S T U V W X Y Z A B C D E F G H I J K L M N O P Q

S T U V W X Y Z A B C D E F G H I J K L M N O P Q R

T U V W X Y Z A B C D E F G H I J K L M N O P Q R S

U V W X Y Z A B C D E F G H I J K L M N O P Q R S T

V W X Y Z A B C D E F G H I J K L M N O P Q R S T U

W X Y Z A B C D E F G H I J K L M N O P Q R S T U V

X Y Z A B C D E F G H I J K L M N O P Q R S T U V W

Y Z A B C D E F G H I J K L M N O P Q R S T U V W X

Z A B C D E F G H I J K L M N O P Q R S T U V W X Y

To use the above table, treat the first row, starting with A as the plaintext row. Each of the other 25 rows is the ciphertext corresponding to the letter above it on the first row. For example, if (plaintext) C is coded as (ciphertext) R in a shift code, we look under the C in the first row until we find R. This is in row P, and this determines the shift code. We then use row A plaintext and row P as ciphertext, and this will allow quick coding and decoding.

  1. Code the message YOUR QUEEN IS IN DANGER, using a Vigen`ere cipher with key word ENOUGH.
  2. Code the message THE BEATLES LIVE, using a Vigen`ere cipher with key word YEAH.
  3. The message QRSGA LVVGE XKMUA IRAA was sent to Erich, and electronically intercepted by a student. It was guessed that this is a Vigen`ere cipher, probably with key word ERICH. Test this and see if you can decode this message.
  4. The message BAEPI HYDTS NFSEH EHCIX EUNPG SWTTN NTHTM was sent to Paul, and electronically intercepted by a student. It was guessed that this is a Vigen`ere cipher, probably with key word PAUL. Test this and see if you can decode this message.
  5. Using the algorithm on page 49 solve the congruence 151x ≡ 1 mod 2301.
  6. Find the inverse of 323 mod 2600.
  7. Using the affine block substitution c ≡ 49 p + 301 mod 2600, code the message DO IT NOW.
  8. Using the affine block substitution p ≡ 179 c + 1515 mod 2600, code the message NO WAY.
  9. The message 0830 1430 2345 is received, and it is known to be an affine block substitution with formula c ≡ 17 p + 345 mod 2600. What is the plaintext message?
  10. The message 0761 1310 2012 is received, and it is known to be an affine block substitution with formula c ≡ 349 p + 1712 mod 2600. What is the plaintext message?
  11. Solve the congruence for p: c ≡ 3 p − 1 mod 26.
  12. Solve the congruence for p: c ≡ 7 p + 3 mod 26.
  13. Solve the congruence for p: c ≡ 3 p − 1 (mod 50).
  14. Solve the congruence for p: c ≡ 11 p + 2 (mod 52).

The following are optional problems, not covered in the notes.

  1. Find a number x such that x ≡ 7 mod 11 and x ≡ 3 mod 7.
  2. The integers x and y satisfy the congruences: 3 x + 4y ≡ 9 (mod 100); 5x + 9y ≡ 11 (mod 100). Find possible integer solutions x and y.