Chapter 2
|
| P | set of all possible plaintexts |
| C | set of all possible ciphertexts |
| K | set of all possible keys |
| Property | Reason |
| eK must be one-to-one | if y=eK(x1)=eK(x2) with x1 ¹ x2 then Bob |
| would be unable to decrypt y | |
| dK(eK(x))=x for each x Î P | to enable Bob to decipher all messages from Alice |
| if P=C then each eK is | if the set of plaintexts and ciphertexts is identical |
| a permutation and dK is | then each encryption rule eK just rearranges |
| the inverse permutation | (permutes) the elements of this set. |
Oscar's job is to find x, knowing y and without knowing the key K, but possibly knowing the type of encryption system used. This type of decryption is called cryptanalysis. We'll return to it later.
These form a family of ciphers based on modular arithmetic. One such cipher is reputed to have been used by Julius Caesar and is called the Caesar Cipher. Shift Ciphers, and the more general Affine Ciphers we'll meet later, are based on modular arithmetic. The basics of modular arithmetic are reviewed in Chapter 3.
Definition 1 (Shift Cipher)
Let P=C=K=Z26.
For 0 £ K £ 25, define eK:Z26®Z26
and dK:Z26®Z26 as follows (for x, y Î Z26).
eK(x)=x+K mod 26, dK(y)=y-K mod 26
The shift cipher with K=3 is the Caesar cipher.
We use Z26 because there are 26 letters in the
English alphabet. Shift ciphers can be defined for any modulus m.
For ordinary English text set up a correspondence between the alphabetic characters and the integers 0,...,25 as in Table 2.2.
| A | B | C | D | E | F | G | H | I | J | K | L | M |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
A shift cipher with key K operates by `shifting each letter K places to the left'. We illustrate with a simple example.
Example 1
Encrypt the following plaintext with a Shift Cipher with key K=11.
or she proceeds as follows. She converts the plaintext to a sequence
of integers using Table 2.2, obtaining:
Next she adds 11 to each value, reducing the sum modulo 26.
Finally she converts the sequence of integers to alphabetic
characters, obtaining the ciphertext.
A B C D E F G H I J K L M L M N O P Q R S T U V W X
N O P Q R S T U V W X Y Z Y Z A B C D E F G H I J K
0 6 14 14 3 15 17 14 14 5 8 18 14 13 4 19 7 0 19 12 0 10 4 18 20 18 22 8 18 4 17
11 17 25 25 14 0 2 25 25 16 19 3 25 24 15 4 18 11 4 23 11 21 15 3 5 3 7 19 3 15 2
Desirable properties for a cryptosystem:
It should be easy to encipher and decipher, that is, eK and dK should
be efficiently computable.
It should be secure in the sense that, given the ciphertext, the opponent
Oscar should be unable to find the key or the plaintext.
The Shift Cipher (modulo 26) is not secure. Oscar could conduct an exhaustive search by trying out all the possible 26 decryption rules dK in turn until he discovers a plaintext that makes sense.
Example 2
Given the ciphertext
iujkhxkgqkxy
htijgwjfpjwx
gshifvieoivw
frgheuhdnhuv
eqfgdtgcmgtu
dpefcsfblfst
codebreakers
until we find the plaintext. Here we find that the key was K=7 and the plaintext was
`codebreakers'.
For a general substitution cipher we require
P=C, that is the same ciphertext and plaintext alphabet. In
our examples we will take P to be the 26 letter alphabet and identify
it with Z26. The set of keys K will be the set of all
permutations of P. For a permutation p Î K,
the rules ep and dp are
|
A shift cipher is a special type of substitution cipher, and there are only 26
of them. Another special type of substitution cipher is an Affine
Cipher. This is one for which the encryption rule is
|
| a | 1 | 3 | 5 | 7 | 9 | 11 | 15 | 17 | 19 | 21 | 23 | 25 |
| a-1 | 1 | 9 | 21 | 15 | 3 | 19 | 7 | 23 | 11 | 5 | 17 | 25 |
To decrypt the ciphertext y=e(x)=ax+b we need ax=y-b and hence x=a-1(y-b).
Thus we must apply the decryption rule
|
Example 1
Encrypt the plaintext fun using an affine cipher with key K=(7,5)
(that is, with encryption rule eK(x)=7x+5).
Convert the letters f, u, n to residues modulo 26 using
Table 2.2, and then apply eK and convert back to letters, againusing Table 2.2.
Plaintext x eK(x) Ciphertext f 5 7·5+5=40=14 mod 26 O u 20 7·20+5=145 = 15 mod 26 P n 13 7·13+5=96=18 mod 26 S
Thus the encrypted message is OPS. Bob, knowing the key K=(7,5), decrypts
this with the decryption rule dK(y)=15(y-5) (since 7-1=15).
Ciphertext y dK(y) Plaintext O 14 15(14-5)=135=5 mod 26 f P 15 15(15-5)=150 = 20 mod 26 u S 18 15(18-5)=195=13 mod 26 n
The ciphers described so far are all monoalphabetic ciphers, that is, for each occurrence of a given letter in the plaintext, the same cipher letter is used. A famous cipher that is not monoalphabetic is the Vigenere cipher named after Blaise de Vigenere who lived in the 16th century. The key K is a `keyword' of length m, for example K might be `wombat' of length m=6. We encrypt the plaintext 6 letters at a time by `adding the keyword to the plaintext'. Here is an example. From Table 2.2, the letters of the keyword `wombat' correspond to the numbers 22, 14, 12, 1, 0, 19. We write these out repeatedly under the numbers corresponding to the plaintext, add the result and convert to ciphertext using the correspondence in Table 2.2. We encrypt `Bring me chocolate' in this way as follows.
| Plaintext | b | r | i | n | g | m | e | c | h | o | c | o | l | a | t | e |
| x | 1 | 17 | 8 | 13 | 6 | 12 | 4 | 2 | 7 | 14 | 2 | 14 | 11 | 0 | 19 | 4 |
| keyword | 22 | 14 | 12 | 1 | 0 | 19 | 22 | 14 | 12 | 1 | 0 | 19 | 22 | 14 | 12 | 1 |
| eK(x) | 23 | 5 | 20 | 14 | 6 | 5 | 0 | 16 | 19 | 15 | 2 | 7 | 7 | 14 | 5 | 5 |
| Ciphertext | X | F | U | O | G | F | A | Q | T | P | C | H | H | O | F | F |
To decrypt we follow essentially the same procedure, except that we
`subtract the key word from the ciphertext' to regain the plaintext.
Using a keyword of length m, each plaintext letter x is mapped to
one of m possible ciphertext letters. A cipher with this property is called
polyalphabetic. Usually cryptanalysis is more difficult for
polyalphabetic than monoalphabetic cryptosystems. For the Vigenere cipher, the
number of possible keywords of length m is 26m, which is quite large even
for small values of m; for m=6 this is more than 3×108. So for
quite moderate keyword lengths, it becomes infeasible to search through all
possible keywords.
In all ciphers considered so far, successive plaintext letters, or groups of
letters, have been encrypted using the same key K, that is the ciphertext
string y is obtained as y=y1y2... = eK(x1)eK(x2).... This type of
cryptosystem is called a block cipher. For example, for a
substitution cipher, each plaintext letter xi is encrypted with the single
encryption rule eK to give a ciphertext letter yi=eK(xi). Thus a
substitution cipher is a block cipher with blocks of length 1. On the other
hand, for a Vigenere cipher with key word K=(k1,k2,...,km) of length m,
m different encryption rules ek1,...,ekm are used for encrypting
successive plaintext letters in each block of m plaintext letters, say
x1,x2,...,xm is encrypted as ek1(x1),...,ekm(xm). We can
think of this as a composite encryption rule eK being applied to the string
producing eK(x1x2... xm), a ciphertext string of length m. Thus we
think of the Vigenere cipher as being a block cipher with blocks of length m:
we apply the same composite encryption rule eK to each block of length m of
the plaintext.
We often want to send encrypted messages electronically and so we may wish to
convert English symbols and numerals (whatever is in our normal plaintext
alphabet) into strings of integers modulo 2 (that is, elements of Z2,
also called binary integers or bits). For example, since there are
26=64 different bit strings of length 6, we would be able to assign a
different bit string of length 6 to each of the 26 lower case letters, each of
the 26 upper case letters, and each of the ten numerals, and still have two left
over. Suppose we decided to group our plaintext into strings with five letters
or numerals in each string, and to convert each letter or numeral into a bit
string of length 6. Then we would have converted the plaintext into blocks each
consisting of 30 bits. A cipher that encrypts these 30-bit strings block by
block would be a block cipher with blocks of length 30. As far as the cipher is
concerned the encryption key is acting on bit strings of length 30 and the
plaintext alphabet P is the set of all 30-bit strings, so P
contains 230 » 109 different elements (30-bit strings).
Currently the most commonly used block ciphers have blocks consisting of bit
strings of length 64. This means that the plaintext alphabet has 264
elements! However 64 bit blocks are becoming insecure against modern computer
cryptanalytic attack, and block ciphers are moving towards having blocks of 1024
or 2048 bits.
Historically there are several other block ciphers we could mention that use
different ideas, and that have influenced future developments.
One polyalphabetic cipher that encrypts the plaintext m letters at a time
is the Hill Cipher, invented in 1929 by Lester S. Hill. It
utilises linear algebra over Z26. The key K is an invertible
m×m matrix with entries in Z26, and each string of m
characters from the Plaintext is first converted to a sequence x of m
numbers in Z26, so x Î Z26m. Then x is
encrypted by multiplying by the matrix K: eK(x)=xK. The decryption rule
is dK(y)=yK-1.
Another block cipher is the transposition cipher, sometimes also called
the permutation cipher. For this cipher, the plaintext message is
divided into blocks of a certain length m, and a permutation p is applied
to rearrange the letters in each block. For example, if m=5 and
|
| Plaintext | t | h | i | s | i | s | n | o | t | s | e | c | u | r | e | ||
| Ciphertext | H | I | T | I | S | N | S | S | O | T | C | E | E | U | R |
The transposition cipher can be decrypted by applying the inverse permutation
p-1. The transposition cipher is not secure against cryptanalytic
attack. However a
combination of a substitution cipher followed by a transposition cipher
results in a cipher that is more difficult to break by hand.
An alternative to block ciphers is to use what are called stream ciphers. A
keystream is generated z=z1z2... and used to encrypt
a Plaintext x=x1x2... by the rule y = ez1(x1)ez2(x2).... The keystream elements zi usually depend on the original
key K and also on the preceding plaintext x1, x2,...,xi-1. This
approach can be used to model mathematically many cryptosystems, including the
one-time pad (see below).
Start with a key K Î K and the plaintext string x=x1x2.... For each i there is a rule (function) fi for generating the
keystream element zi based on the key K and x1, x2,...,xi-1, that is,
|
Example 1
(a) A block cipher can be thought of as a special type of stream cipher by taking
a constant keystream zi=K for all i.
(b) A stream cipher is periodic with period d if zi+d=zi for
all i. The Vigenere cipher with key word of length m can be thought of as a
periodic stream cipher with period m. In this case the keyword
K=(k1,k2,...,km) gives the first m elements of the keystream
z1=k1,...,zm=km, and the keystream just repeats itself from this point
on. The encryption and decryption rules are simple: ez(x)=x+z, dz(y)=y-z.
(c) Stream ciphers are often defined with the plaintext, ciphertext, and
keystream elements all being integers modulo 2 (bits).
In this case
(d) The case where the plaintext is a string of n integers mod 2, say
x1x2... xn, and also
the key K=(k1,k2,...,kn) is a string of the same length n of
integers mod 2 is called the one-time pad. Here
so encryption and decryption are easy. If we think of 0 as `false' and 1 as
`true' then addition mod 2 corresponds to the `exclusive-or' operation and can be implemented
very efficiently in computer hardware.
ez(x)=x+z mod 2, and dz(y)=y+z mod 2
eK(x1,x2,..., xn)=(x1+k1,x2+k2,...,xn+kn) mod 2, and
This was described and patented by Gilbert Vernam in 1917. It is an unconditionally
secure cryptosystem (provided the key is kept secret), and is important
in military and diplomatic contexts. However it has limited use commercially
because of key management problems: the key which must be communicated securely
has length equal to the message length. Historical efforts in cryptography have been
to design cryptosystems where one key can be used for many messages while maintaining
(at least) computational security.
dK(y1,y2,..., yn)=(y1+k1,y2+k2,...,yn+kn) mod 2.
There are many other interesting `classical' ciphers. An excellent account
can be found in the Code Book by Simon Singh. This includes
stories about many of the ciphers used during World War II. Many books on
classical cryptography can be found in the library. More recently a cipher
called Solitaire involving a pack of cards for both encryption and
decryption was suggested in the novel `Cryptonomicon' by Neal Stephenson. This
cipher was developed by Bruce Schneier and a description can be found
on the Counterpane Internet Security web site.
The golden rule for designers of cryptosystems is never to underestimate the cryptanalyst.
Kerckhoff's Principle 1883: Assume that the cryptanalyst (opponent)
knows the cryptosystem.
It would be unwise to design a cryptosystem without assuming
Kerckhoff's Principle. The goal is to achieve security while observing
it. There are different levels of attack on cryptosystems
and the most common ones are listed in Table 2.5. The objectis always to determine the key K. The `chosen ciphertext attack' is in
particular relevant to public-key cryptosystems, which we discuss later.
| Type | Description |
| Ciphertext only | The opponent possesses a string of ciphertext y. |
| Known plaintext | The opponent possesses a string of plaintext x and the |
| corresponding ciphertext y. | |
| Chosen plaintext | The opponent has obtained temporary access to the |
| encryption machinery; has chosen a string of plaintext x | |
| and constructed the corresponding ciphertext string y. | |
| Chosen ciphertext | The opponent has obtained temporary access to the |
| decryption machinery; has chosen a string of ciphertext y | |
| and constructed the corresponding plaintext string x. |
Consider the weakest type of attack, the `ciphertext only attack'. Assume that
the plaintext is English or some other structured language. Then a frequency
count will give good guesses for the commonly occurring letters: simply work
out the frequency of commonly occurring letters in the ciphertext and compare
these against the English frequency statistics, see Table 2.6, to guess what they stand for in the plaintext. The rest can be broken by the
redundancy naturally present in English. (The data in Table 2.6is from Beker and Piper, p.397.)
From Table 2.6, the most commonly occurring letters in English are, in order, E T A O I N S R H ¼. Also the most common pairs are TH, HE, IN, ER, AN, RE ¼, and the most common triples are THE, AND, ING, ION. You have an opportunity to try this out in a simple way with the last question in the Exercise Set on Classical Ciphers.
| letter | probability | letter | occurrence |
| A | .082 | N | .067 |
| B | .015 | O | .075 |
| C | .028 | P | .019 |
| D | .043 | Q | .001 |
| E | .127 | R | .060 |
| F | .022 | S | .063 |
| G | .020 | T | .091 |
| H | .061 | U | .028 |
| I | .070 | V | .010 |
| J | .002 | W | .023 |
| K | .008 | X | .001 |
| L | .040 | Y | .020 |
| M | .024 | Z | .001 |
1. Encrypt the following using a Shift Cipher with key K=4.
2. The following was encrypted using a Shift Cipher. Decrypt it.
What was the key?
3. Show that the ciphertext of dog using an affine cipher with key
K=(3,9) is YXT.
4. Decrypt the ciphertext YATJ if an affine cipher with key
K=(11,2) was used for encryption.
5. Decrypt the ciphertext
6. Below are given three examples of ciphertext, each
obtained from either a shift cipher or an affine cipher. In each case determine
what type of cipher was used, and find the key. If you have the energy find the
plaintext. I have left in the punctuation and spaces between words to make it
easier. (With one of them, you may need to `decipher' it further after
decryption.)
6A
Y SYQR WYXRWJ AG DUXRWJ OJ AG AOXRWJ, OJ YHPWWP BOXR OD XRWA, UQ XRWG SWJW
YH PEXG BOXR WCEUTTG BOEHP XO YX, RUP AYHPWP SRUX XRWG SWJW UBOEX SRWH XRWG
BWKOX AW; RUP XRWG PETG IOHQYPWJ'P ROS AEIR PWVWHPWP EVOH SRUX XRWG SWJW
XRWH POYHK;-XRUX HOX OHTG XRW VJOPEIXYOH OD U JUXYOHUT BWYHK SUQ IOHIWJHWP
YH YX, BEX XRUX VOQQYBTG XRW RUVVG DOJAUXYOH UHP XWAVWJUXEJW OD RYQ BOPG,
VWJRUVQ RYQ KWHYEQ UHP XRW LWJG IUQX OD RYQ AYHP;-UHP, DOJ UEKRX XRWG MHWS
XO XRW IOHXJUJG, WLWH XRW DOJXEHWQ OD RYQ SROTW ROEQW AYKRX XUMW XRWYJ XEJH
DJOA XRW REAOEJQ UHP PYQVOQYXYOHQ SRYIR SWJW XRWH EVVWJAOQX;-RUP XRWG PETG
SWYKRWP UHP IOHQYPWJWP UTT XRYQ, UHP VJOIWWPWP UIIOJPYHKTG,-Y UA LWJYTG
VWJQEUPWP Y QROETP RULW AUPW U CEYXW PYDDWJWHX DYKEJW YH XRW SOJTP, DJOA
XRUX YH SRYIR XRW JWUPWJ YQ TYMWTG XO QWW AW.-BWTYWLW AW, KOOP DOTMQ, XRYQ
YQ HOX QO YHIOHQYPWJUBTW U XRYHK UQ AUHG OD GOE AUG XRYHM YX;-GOE RULW
UTT, Y PUJW QUG, RWUJP OD XRW UHYAUT QVYJYXQ, UQ ROS XRWG UJW XJUHQDEQWP
DJOA DUXRWJ XO QOH, WXI. WXI.-UHP U KJWUX PWUT XO XRUX VEJVOQW:-SWTT, GOE
AUG XUMW AG SOJP, XRUX HYHW VUJXQ YH XWH OD U AUH'Q QWHQW OJ RYQ HOHQWHQW,
RYQ QEIIWQQWQ UHP AYQIUJJYUKWQ YH XRYQ SOJTP PWVWHP EVOH XRWYJ AOXYOHQ UHP
UIXYLYXG, UHP XRW PYDDWJWHX XJUIMQ UHP XJUYHQ GOE VEX XRWA YHXO, QO XRUX
SRWH XRWG UJW OHIW QWX U-KOYHK, SRWXRWJ JYKRX OJ SJOHK, 'XYQ HOX U RUTD-
VWHHG AUXXWJ,-USUG XRWG KO ITEXXWJYHK TYMW RWG-KO AUP; UHP BG XJWUPYHK XRW
QUAW QXWVQ OLWJ UHP OLWJ UKUYH, XRWG
VJWQWHXTG AUMW U JOUP OD YX, UQ VTUYH
UHP UQ QAOOXR UQ U KUJPWH-SUTM, SRYIR, SRWH XRWG UJW OHIW EQWP XO, XRW
PWLYT RYAQWTD QOAWXYAWQ QRUTT HOX BW UBTW XO PJYLW XRWA ODD YX.
VJUG AG PWUJ, CEOXR AG AOXRWJ, RULW GOE HOX DOJKOX XO SYHP EV XRW ITOIM?-
KOOP K..! IJYWP AG DUXRWJ, AUMYHK UH WZITUAUXYOH, BEX XUMYHK IUJW XO
AOPWJUXW RYQ LOYIW UX XRW QUAW XYAW,-PYP WLWJ SOAUH, QYHIW XRW IJWUXYOH OD
XRW SOJTP, YHXWJJEVX U AUH SYXR QEIR U QYTTG CEWQXYOH? VJUG, SRUX SUQ GOEJ
DUXRWJ QUGYHK?-HOXRYHK.
6B XQNGPGNC
SYTU DGS GVNY NDU KQV -- AUVNPC GNK NYQOD IWYMU DGS YVOU, IN DYSU, WDGKBUHGVA YX XGUPRK QVKYWV. IPWICK GN WYMU DGS, UTUV GV XHIVOU, QVNGP NDGK SYHVGVA IVR NDGK KVYW. GX IVCNDGVA SGADN HYQKU DGS VYW NDU MGVR YPR KQV WGPP MVYW. NDGVM DYW GN WIMUK NDU KUURK -- WYMU, YVOU, NDU OPICK YX I OYPR KNIH. IHU PGSLK KY RUIH-IODGUTUR, IHU KGRUK XQPP-VUHTUR, -- KNGPP WIHS, -- NYY DIHR NY KNGH? WIK GN XYH NDGK NDU OPIC AHUW NIPP? -- Y WDIN SIRU XINQYQK KQVLUISK NYGP NY LHUIM UIHND'K KPUUB IN IPP?
6C GJJXKYY ZU G NGMMOY
LGOX LG' EUAX NUTKYZ, YUTYOK LGIK, MXKGZ INOKLZGOT U' ZNK VAJJOTM-XGIK! GHUUT ZNKS G' EKZ ZGQ EUAX VRGIK, VGOTIN, ZXOVK, UX ZNGOXS: CKKR GXK EK CUXJE U'G MXGIK GY RGTM'Y SE GXS. ZNK MXUGTOTM ZXKTINKX ZNKXK EK LORR, EUAX NAXJOKY ROQK G JOYZGTZ NORR, EUAX VOT CGY NKRV ZU SKTJ G SORR OT ZOSK U'TKKJ, CNORK ZNXU' EUAX VUXKY ZNK JKCY JOYZOR ROQK GSHKX HKGJ. NOY QTOLK YKK XAYZOI RGHUAX JOMNZ, GT' IAZ EUA AV CO' XKGJE YRKOMNZ, ZXKTINOTM EUAX MAYNOTM KTZXGORY HXOMNZ, ROQK UTE JOZIN; GTJ ZNKT, U CNGZ G MRUXOUAY YOMNZ, CGXS-XKKQOT', XOIN! ZNKT, NUXT LUX NUXT, ZNKE YZXKZIN GT' YZXOBK: JKOR ZGQ ZNK NOTJSUYZ! UT ZNKE JXOBK, ZORR G' ZNKOX CKKR-YCGRR'J QEZKY HKREBK GXK HKTZ ROQK JXASY; ZNKT GARJ MAOJSGT, SGOYZ ROQK ZU XOBK, HKZNGTQOZ! NASY. OY ZNKXK ZNGZ UCXK NOY LXKTIN XGMUAZ UX UROU ZNGZ CGJ YZGC G YUC, UX LXOIGYYKK CGJ SGQK NKX YVKC CO' VKXLKIZ YIUTTKX, RUUQY JUCT CO' YTKKXOTM, YIUXTLA' BOKC UT YOI G JOTTKX? VUUX JKBOR! YKK NOS UCXK NOY ZXGYN, GY LKIQRKY GY COZNKX'J XGYN, NOY YVOTJRK YNGTQ, G MAOJ CNOV-RGYN; NOY TOKBK G TOZ; ZNXU' HRUJE LRUUJ UX LOKRJ ZU JGYN, U NUC ATLOZ! HAZ SGXQ ZNK XAYZOI, NGMMOY-LKJ, ZNK ZXKSHROTM KGXZN XKYUATJY NOY ZXKGJ. IRGV OT NOY CGROK TOKBK G HRGJK, NK'RR SGQ OZ CNOYYRK; GT' RKMY GT' GXSY, GT' NGTJY CORR YTKJ, ROQK ZGVY U' ZXOYYRK. EK VUC'XY, CNG SGQ SGTQOTJ EUAX IGXK, GTJ JOYN ZNKS UAZ ZNKOX HORR U' LGXK, GARJ YIUZRGTJ CGTZY TGK YQOTQOTM CGXK ZNGZ PGAVY OT RAMMOKY; HAZ, OL EK COYN NKX MXGZKLA' VXGEKX MOK NKX G NGMMOY!
1. PSKMGMWXLICSYXLSJQEXLIQEXMGW
2. Life is not a problem. It is a mystery to be unfurled.
The key was K=3.
3.
| Plaintext | x | eK(x) | Ciphertext |
| d | 3 | 7·3+3=24 mod 26 | Y |
| o | 14 | 7·14+3=101 = 23 mod 26 | X |
| g | 6 | 7·6+3=45 = 19 mod 26 | T |
4. Since 11-1=19 in Z26, dK(y)=19(y-2).
We decrypt as in the table below and find the plaintext `cold'.
| Ciphertext | y | dK(y) | Plaintext |
| Y | 24 | 19(24-2)=418 = 2 mod 26 | c |
| A | 0 | 19( 0-2)=-38=14 mod 26 | o |
| T | 19 | 19(19-2)=323=11 mod 26 | l |
| J | 9 | 19( 9-2)=133 = 3 mod 26 | d |
5. The keyword `maths' corresponds to the sequence 12,
0, 19, 7, 18. We therefore decrypt as follows.
| Ciphertext | U | W | T | U | L | F | P | T | Z | K | F | H | B | Z |
| y | 20 | 22 | 19 | 20 | 11 | 5 | 15 | 19 | 25 | 10 | 5 | 7 | 1 | 25 |
| keyword | 12 | 0 | 19 | 7 | 18 | 12 | 0 | 19 | 7 | 18 | 12 | 0 | 19 | 7 |
| dK(y) | 8 | 22 | 0 | 13 | 19 | 19 | 15 | 0 | 18 | 18 | 19 | 7 | 8 | 18 |
| Plaintext | i | w | a | n | t | t | p | a | s | s | t | h | i | s |
| M | Z | I | M |
| 12 | 25 | 8 | 12 |
| 18 | 12 | 0 | 19 |
| 20 | 13 | 8 | 19 |
| u | n | i | t |
Plaintext: I want to pass this unit.
6A. This used an affine cipher eK:x® ax+b
with a=7, b=20 modulo 26. The plaintext is from the first chapter
of Tristan Shandy by Lawrence Stern.
I wish either my father or my mother, or indeed both of them, as they were
in duty both equally bound to it, had minded what they were about when they
begot me; had they duly consider'd how much depended upon what they were
then doing;-that not only the production of a rational Being was concerned
in it, but that possibly the happy formation and temperature of his body,
perhaps his genius and the very cast of his mind;-and, for aught they knew
to the contrary, even the fortunes of his whole house might take their turn
from the humours and dispositions which were then uppermost;-Had they duly
weighed and considered all this, and proceeded accordingly,-I am verily
persuaded I should have made a quite different figure in the world, from
that in which the reader is likely to see me.-Believe me, good folks, this
is not so inconsiderable a thing as many of you may think it;-you have
all, I dare say, heard of the animal spirits, as how they are transfused
from father to son, etc. etc.-and a great deal to that purpose:-Well, you
may take my word, that nine parts in ten of a man's sense or his nonsense,
his successes and miscarriages in this world depend upon their motions and
activity, and the different tracks and trains you put them into, so that
when they are once set a-going, whether right or wrong, 'tis not a half-
penny matter,-away they go cluttering like hey-go mad; and by treading the
same steps over and over again, they presently make a road of it, as plain
and as smooth as a garden-walk, which, when they are once used to, the
Devil himself sometimes shall not be able to drive them off it.
Pray my Dear, quoth my mother, have you not forgot to wind up the clock?-
Good G..! cried my father, making an exclamation, but taking care to
moderate his voice at the same time,-Did ever woman, since the creation of
the world, interrupt a man with such a silly question? Pray, what was your
father saying?-Nothing.
6B. This used an affine cipher eK:x® ax+b
with a=3, b=8 modulo 26. The plaintext is a poem by Wilfred Owen.
Futility Move him into the sun -- Gently its touch awoke him once, At home, whispering of fields unsown. Always it woke him, even in France, Until this morning and this snow. If anything might rouse him now The kind old sun will know. Think how it wakes the seeds -- Woke, once, the clays of a cold star. Are limbs so dear-achieved, are sides Full-nerved, -- still warm, -- too hard to stir? Was it for this the clay grew tall? -- O what made fatuous sunbeams toil To break earth's sleep at all?
6C. This used a shift cipher eK:x® x+6.
The plaintext is a poem by Robert Burns.
Address To A Haggis Fair fa' your honest, sonsie face, Great chieftain o' the pudding-race! Aboon them a' yet tak your place, Painch, tripe, or thairm: Weel are ye wordy o'a grace As lang's my arm. The groaning trencher there ye fill, Your hurdies like a distant hill, Your pin was help to mend a mill In time o'need, While thro' your pores the dews distil Like amber bead. His knife see rustic Labour dight, An' cut you up wi' ready sleight, Trenching your gushing entrails bright, Like ony ditch; And then, O what a glorious sight, Warm-reekin', rich! Then, horn for horn, they stretch an' strive: Deil tak the hindmost! on they drive, Till a' their weel-swall'd kytes belyve Are bent like drums; Then auld Guidman, maist like to rive, Bethankit! hums. Is there that owre his French ragout Or olio that wad staw a sow, Or fricassee wad make her spew Wi' perfect sconner, Looks down wi' sneering, scornfu' view On sic a dinner? Poor devil! see him owre his trash, As feckles as wither'd rash, His spindle shank, a guid whip-lash; His nieve a nit; Thro' blody flood or field to dash, O how unfit! But mark the Rustic, haggis-fed, The trembling earth resounds his tread. Clap in his walie nieve a blade, He'll mak it whissle; An' legs an' arms, an' hands will sned, Like taps o' trissle. Ye Pow'rs, wha mak mankind your care, And dish them out their bill o' fare, Auld Scotland wants nae skinking ware That jaups in luggies; But, if ye wish her gratefu' prayer Gie her a haggis!