Difference between revisions of "Codebusters"

From Scioly.org
Jump to: navigation, search
(External Links: replaced with working links)
Line 1,265: Line 1,265:
:{{SpoilerBoxBegin}} North Carolina SO Practice Tests and Keys
:{{SpoilerBoxBegin}} North Carolina SO Practice Tests and Keys
:[http://www.sciencenc.com/event-help/2017%20events/CodeBustersSampleTest1.pdf 2016-2017 Practice Test]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%201.pdf Practice Test 1]
::[http://www.sciencenc.com/event-help/2017%20events/CodeBustersSampleAnswers1.pdf 2016-2017 Practice Test KEY]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%201%20Answers.pdf Practice Test 1 KEY]
:[http://www.sciencenc.com/event-help/2017%20events/Code%20Busters%20Sample%20Test4.pdf Practice Test 1]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%202.pdf Practice Test 2]
::[http://www.sciencenc.com/event-help/2017%20events/Code%20Busters%20Sample%20Answers4.pdf Practice Test 1 KEY]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%202%20Answers.pdf Practice Test 2 KEY]
:[http://www.sciencenc.com/event-help/2017%20events/CodeBustersSampleTest2.pdf Practice Test 2]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%203.pdf Practice Test 3]
::[http://www.sciencenc.com/event-help/2017%20events/CodeBustersSampleAnswers2.pdf Practice Test 2 KEY]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%203%20Answers.pdf Practice Test 3 KEY]
:[http://www.sciencenc.com/event-help/2017%20events/Code%20Busters%20Sample%20Test4.pdf Practice Test 4]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%204.pdf Practice Test 4]
::[http://www.sciencenc.com/event-help/2017%20events/Code%20Busters%20Sample%20Answers5.pdf Practice Test 4 KEY]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%204%20Answers.pdf Practice Test 4 KEY]
:[http://www.sciencenc.com/event-help/2017%20events/CodeBustersSampleTest7.pdf Practice Test 7 (Patristocrats)]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%205.pdf Practice Test 5]
::[http://www.sciencenc.com/event-help/2017%20events/Code%20Busters%20Sample%20Answers7.pdf Practice Test 7 (Patristocrats) KEY]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%205%20Answers.pdf Practice Test 5 KEY]
:[http://www.sciencenc.com/event-help/2017%20events/Code%20Busters%20Sample%20Test6.pdf ALL SPANISH Test]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%206.pdf Practice Test 6]
::[http://www.sciencenc.com/event-help/2017%20events/CodeBustersSampleAnswers6.pdf ALL SPANISH Test Key]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%206%20Answers.pdf Practice Test 6 KEY]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%207.pdf Practice Test 7]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%207%20Answers.pdf Practice Test 7 KEY]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%208.pdf Practice Test 8]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%208%20Answers.pdf Practice Test 8 KEY]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%209.pdf ALL SPANISH Test]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%209%20Answers.pdf ALL SPANISH Test KEY]
:[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%2010.pdf Practice Test 10]
::[http://toebes.com/Ciphers/Samples/Code%20Busters%202018%20Sample%2010%20Answers.pdf Practice Test 10 KEY]
Past tests can also be found [http://toebes.com/Ciphers/index.html here].

Revision as of 02:22, 19 May 2018

Code Busters was a trial event at the 2016 National Tournament and will be held at the 2018 National Tournament as a trial event once again. In this event, up to 3 participants must decode encrypted messages, or they may be required to encode messages with certain advanced ciphers. Competitors are not allowed to bring any resources to this event, but can bring a 4 or 5 function calculator - no scientific or graphing calculators allowed.

Test Description

The test is given in an order of increasing difficulty in an exam booklet, and the supervisor may require answers to be written on index cards instead of the booklet. The very first cryptogram is timed - when solved, a team member should raise their hand/shout "bingo!"/etc to alert the supervisor. Teams will receive bonus points depending on their time, but they may make as many attempts as they want to break the code without any penalties. The first cryptogram may also be used as a tiebreaker. If the first cryptogram is unsolved, teams are automatically put on Tier II. The time bonus for the first code is 1 million divided by the number of seconds taken. Solutions are deemed correct only if the solution is an exact match or differs by only one or two letters.

Because the affine, Hill, and Vigenère ciphers may be hard to decrypt, students may be asked to encrypt with them.

Note: The following cryptogram types are listed in a hierarchy of difficulty.

Mono-alphabetic Substitution

A mono-alphabetic substitution is one where the same plaintext letters are replaced by the same ciphertext letters. Since specific encryption/decryption methods are not mentioned in the rules, a variety of ways will be covered in the following section.

Solving a Caesar Shift cipher

One example of a mono-alphabetic substitution is Caesar shift cipher, where each letter is replaced by one shifted by a certain amount. For example, the following table has each letter shifted three positions to the right.

Caesar Shift Example Table
Original Alphabet 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
Shifted Alphabet (to the right 3) 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

From this table, it is clear that each shifted letter is the same as the original letter three spaces from it (A becomes D, B becomes E, etc). Thus, a message like "Science Olympiad is cool" would become "Vflhqfh Robpsldg lv frro" using a Caesar shift of 3. The alphabet can be shifted any number of times. This type of cryptogram can be solved through brute force, by taking a section of the message and writing out all 26 possible shifts below it, upon which the message is easily revealed. For example, try to decode "xhntqd". First, write out the ciphertext. Then, write out the possible shifts below it.

Example Decoding
Decryption Shift Possible Plaintext
0 xhntqd
1 wgmspc
2 vflrob
3 uekqna
4 tdjpmz
5 scioly

After shifting "xhntqd" five times, the plaintext is revealed to be "scioly", and no further shifts need to be tested.

Solving a mono-alphabetic substitution cipher using patterns

Table of letter frequency in English.

This may be the most common way to solve a cipher on a Code Busters test, because the supervisor may not write that a Caesar cipher etc. was used to encrypt.

First, find the corresponding letter for a few cipher letter by:

  1. Look for words that are only one letter long. These will almost always be A or I, unless the cryptogram is a poem, in which case O may be used. I usually appears at the start of the sentence, while A is usually more common.
  2. Look for repeated blocks of three. The block is often THE: THE is the most common english word, used almost twice as often as the second most common, BE.
  3. Look for frequency of letters. The 12 most frequent letters in the English alphabet are ETAOIN SHRDLU, with E being the most common by a significant margin.
  4. Look for contractions. If an apostrophe is seen in the ciphertext, it can be an easy way to start deciphering using the table below.
  5. Look for double letters. They're often LL, followed in frequency by EE, SS, OO and TT.

Two clues may give different substitution, in which case experimenting may be helpful.

Then, substitute the known letters, and gradually decode more words using the word fragments. Starting with two or three-letter words are often easier, because of the limited possibilities.

Endings Examples
'T Won't, Don't, Isn't, Aren't, Weren't, Shouldn't, Couldn't, Didn't, Can't
'S He's, She's, It's, Who's, There's, That's
'D I'd, He'd, She'd, We'd, They'd, You'd
'M I'm
'RE You're, They're, We're
'VE They've, You've, We've
'LL I'll, He'll, She'll, We'll, They'll, It'll, Who'll

Messages with Spaces and a Hint

These cryptograms are similar to those published in 20th century newspapers. These are usually solved using patterns, as described above, with the hint providing additional information to assist the decryption.

Messages with Spaces

These cryptograms are similar to NSA and diplomatic messages, and do not have a hint. These are usually solved using patterns, as described above.

Messages with Spaces and Spelling Errors

These cryptograms are similar to FBI and organized crime messages. These are often solved by patterns, with additional care:

  • The letter frequencies likely do not change, and can be applied.
  • THE and many of the most common words are seldom misspelled, unless intentionally. OF may be unintentionally misspelled as UV.
  • Piecing together words with word fragments may be more difficult. Misspelled words often sound the same as the actual word, which can be used to check the decrypted message.

Messages without Spaces

These cryptograms are similar to NSA and espionage messages, and have a hint. An example is: "UVYNYGUSZYSBZBULAPIAZUACAZZAMLGFALPERAJZNYGUUAFBR". Students are told that the last word is TODAY, and the cipher begins with a three-letter word, followed by a four-letter word.

  1. Begin by writing in TODAY. UVYNYGUSZYSBZBULAPIAZUACAZZAMLGFALPERAJZNYGUTODAY. From this, we can see that U represents T, A represents O, F represents D, B represents A, and R represents Y.
  2. Replace the cipher text with the decrypted letters. TVYNYGTSZYSBZATLOPIOZTOCOZZOMLGDOLPEYOJZNYGTTODAY
  3. The first word is a 3 letter word beginning with T, which we can guess decrypts to THE. Replace Vs with H and Y with E. THENEGTSZESAZATLOPIOZTOCOZZOMLGDOLPEYOJZNEGTTODAY
  4. In this cipher, we can see the phrase "TOCOZZOM". Because of the double Z in the middle, it can be inferred that this decrypts to TOMORROW. Replace Z with R, C with M, and M with W. THENEGTSRESARATLOPIORTOMORROWLGDOLPEYOJRNEGTTODAY.
  5. We can see the letters YOJR. This is probably YOUR. Replace J with U. THENEGTSRESARATLOPIORTOMORROWLGDOLPEYOURNEGTTODAY.
  6. The letters LG after the noun TOMORROW likely decrypt to IS. Replace L with I and G with S. THENESTSRESARATIOPIORTOMORROWISDOIPEYOURNESTTODAY.
  7. NEST probably decrypts to B, as that is the only word that makes sense in this context. THEBESTSRESARATIOPIORTOMORROWISDOIPEYOURBESTTODAY.
  8. At this point, the cipher is able to be solved using common sense. SRESARATIOP likely means PREPARATION. IOR probably means FOR. DOIPE probably means DOING. Thus, the message is THE BEST PREPARATION FOR TOMORROW IS DOING YOUR BEST TODAY.

Messages without Spaces or Hints

These cryptograms are extremely difficult and may not be tested very frequently. In the event that a test does contain one, the best method is using the patterns listed above, especially finding repeated three letter "phrases" or double letters.

Messages in Spanish

One cryptogram may be in Spanish as a challenge. At states, there will be exactly one. It may be helpful if one of the partners is fluent in or has a few years of knowledge in Spanish.

For Spanish cryptograms, n and ñ are treated as different letters. However, letters with accents are treated the same as without (a and á are the same). This means that, when working with cryptograms, accent marks do not factor in. Also, ch, ll, and rr are NOT considered distinct letters. Thus, "churro" would have 6 letters: c-h-u-r-r-o. The Spanish alphabet used for cryptograms is as follows:

Spanish Alphabet

The frequency table of Spanish letters is as follows, from most to least frequent:

Spanish Letter Frequency Table
Letter E A O S N R I L D T U C M P
Frequency 14.08% 12.16% 9.20% 7.20% 6.83% 6.41% 5.98% 5.24% 4.67% 4.60% 4.69% 3.87% 3.08% 2.89%
Letter B H Q Y V G F J Z Ñ X K W
Frequency 1.49% 1.18% 1.11% 1.09% 1.05% 1.00% 0.69% 0.52% 0.47% 0.17% 0.14% 0.11% 0.04%

Spanish cryptograms are often solved with patterns as well, with a few differences:

  • Look for the two most common letters, instead of the most common letters: E and A have relatively close frequency, and are much higher than the rest.
  • The most common spanish words are DE, LA, QUE, EL, EN. Since Spanish has far more two-letter words, it is helpful to decrypt them, using the placement of the letter E. QUE is the most common three-letter word, almost twice as common as the next ones.
  • Decrypting words using word fragments are much more difficult for teams without fluency in Spanish.

Affine Cipher and Modular Arithmetic

The Affine cipher uses an alphabet of size [math]m[/math] with keys [math]a[/math] and [math]b[/math] such that [math]a,b[/math] are integers, and [math]a[/math] and [math]m[/math] are coprime (there is no positive divisor for both of them besides 1). Assuming the alphabet is of size 26, [math]a[/math] can be 1, 3, 5, 7, 9, 11 ,15, 17, 19, 21, 23 and 25. Each letter in the alphabet corresponds to a number from [math]0[/math] to [math]m-1[/math]. The most common correspondence for the English alphabet is shown below.

Letter 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
Number 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

The encryption formula for an Affine cipher is:

[math]E(x)=(ax+b)\bmod m.[/math]

In the formula, [math]x[/math] is the corresponding number of plaintext. For example, if encrypting N, [math]x[/math] would be 13. Essentially, numbers are plugged into the formula and the resulting number corresponds to the encrypted letter.

For this example, we encode the message CODEBUSTERS using [math]a=9[/math] and [math]b=42[/math]. To slightly speed up the process, use the fact from modular arithmetic that the function [math]ax+b[/math] does not change if we also take [math]a, b[/math] modulo 26: the function [math]9x+42[/math] is equivalent to the function [math]9x+16[/math] or [math]9x-10[/math].

Affine Cipher Encryption
Plaintext C O D E B U S T E R S
[math]x[/math] 2 14 3 4 1 20 18 19 4 17 18
[math]9x+42[/math] 60 168 69 78 51 222 204 213 78 195 204
[math](9x+42)\bmod 26[/math] 8 12 17 0 25 14 22 5 0 13 22
Ciphertext I M R A Z O W F A N W

The encrypted message is IMRAZOWFANW.

To decrypt the message given the key, use the decryption formula:

[math]D(x)=a^{-1}(x-b)\bmod 26[/math]

In this case, [math]a^{-1}[/math] is the multiplicative inverse of [math]a[/math] modulo [math]m[/math] ([math]aa^{-1}\bmod m=1[/math]). Because there are only 26 values, one can brute force it to find the value of [math]t[/math] where [math]ta \bmod m=1[/math]. [math]t[/math] represents [math]a^{-1}[/math].

Brute Force Table
[math]t[/math] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
[math]9t \bmod 26[/math] 9 18 1 10 19 2 11 20 3 12 21 4 13 22 5 12 14 23 6 15 24 7 16 25 8 17

The table reveals that [math]a^{-1}=3[/math]. Below is a table of [math]a^{-1}[/math] for [math]m=26[/math]:

Inverse Table ([math]m=26[/math])
[math]a[/math] 1 3 5 7 9 11 15 17 19 21 23 25
[math]a^{-1}[/math] 1 9 21 15 3 19 7 23 11 5 17 25

Decrypting then becomes a task of plugging into the formula.

Decryption Table
Ciphertext I M R A Z O W F A N W
[math]x[/math] 8 12 17 0 25 14 22 5 0 13 22
[math]3(x-42)[/math] -102 -90 -75 -126 -51 -84 -60 -111 -126 -87 -60
[math]3(x-42) \bmod 26[/math] 2 14 3 4 1 20 18 19 4 17 18
Plaintext C O D E B U S T E R S

Sometimes, some characters are given, which makes decryption much easier. For example, one might be given the ciphertext "CXWZ ZRC OWGW" and told that the first word is "EDIT". Thus, the characters are mapped as:

Plaintext Ciphertext
E (4) C (2)
D(3) X (23)
I (8) W (22)
T (19) Z (25)

Write out two equations using the first two values and the equation [math]Output=ax+b \bmod 26[/math] in order to solve for [math]b[/math].

[math]a\cdot4+b\bmod 26=2[/math]

[math]a\cdot3+b\bmod 26=23[/math]

Cancel out the [math]a[/math] by multiplying to get the same value (same process as solving a system of equations).

[math]12a+3b\bmod 26=6[/math]

[math]12a+4b\bmod 26=92[/math]

Subtract the equations.

[math]b\bmod 26=86[/math]

Take the mod of the right side.

[math]b\bmod 26=8[/math]

Compute the modulus values to see which works. In this case, 8 works. Now, substitute [math]b[/math] into the equation and repeat the process.

[math]a\cdot3+8\bmod 26=23[/math]

[math]a\cdot3\bmod 26=15[/math]


Hill Cipher

NOTE: These cryptograms will be matrix based, and only use 2x2 or 3x3 matrices.

The alphabet for the Hill cipher has corresponding numbers as follows:

Hill Cipher Alphabet
Letter 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
Number 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Begin by picking a key matrix of either 2x2 or 3x3. These could be a 4 letter word or three 3 letter words. For this example, the key will be WIKI (2x2 matrix). Then, break the message into groups of two. This example will use the message SCIENCE OLYMPIAD, which would be split up into SC IE NC EO LY MP IA DZ. Notice that a Z is added in order to make the last group a group of two. Write the message and the key as matrices.

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} S \\ C \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 18 \\ 2 \end{pmatrix}=\begin{pmatrix} 412 \\ 196 \end{pmatrix}\bmod 26=\begin{pmatrix} 22 \\ 14 \end{pmatrix}=\begin{pmatrix} W \\ O \end{pmatrix}[/math]

In the second step of the above equation, the matrices are multiplied. Although it may seem complicated, matrix multiplication is fairly straightforward.

[math]\begin{pmatrix} A & B \\ C & D \end{pmatrix}*\begin{pmatrix} E \\ F \end{pmatrix}[/math]

The matrices are multiplied as follows: [math]A[/math] and [math]E[/math] are multiplied, then added to the product of [math]B[/math] and [math]F[/math]. [math]C[/math] and [math]E[/math] are multiplied and added to the product of [math]D[/math] and [math]F[/math]. Thus, the product of the matrices is:

[math]\begin{pmatrix} AE + BF \\ CE + DF \end{pmatrix}[/math]

Matrix multiplication for 3x3 matrices is very similar.

[math]\begin{pmatrix} A & B & C \\ D & E & F \\ G & H & I \\ \end{pmatrix}*\begin{pmatrix} J & K & L \\ M & N & O \\ P & Q & R \\ \end{pmatrix}[/math]

Just like in a 2x2 matrix, the row of the first matrix is multiplied by the column of the second matrix, giving the following product.

[math]\begin{pmatrix} AJ+BM+CP & AK+BN+CQ & AL+BO+CR \\ DJ+EM+FP & DK+EN+FQ & DL+EO+FR \\ GJ+HM+IP & GK+HN+IQ & GL+HO+IR \\ \end{pmatrix}[/math]

It is important to note that in order to multiply matrices, the number of columns in the first matrix MUST equal the number of rows in the second matrix. The size of the product matrix is the number of rows in the first matrix x the number of columns in the second matrix.

The "mod" operation is also fairly straightforward. Essentially, it finds the remainder after dividing. For example, [math]153 \bmod 26 [/math] is equal to the remainder of [math]153 / 26[/math], which is 23. On a scientific calculator, this is found by dividing the two numbers, subtracting the integer value from the answer, and multiplying the decimals by the number after "mod" (in this case, 26). Therefore, the process would be:




The rest of the encoding of the message is shown below.

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} S \\ C \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 18 \\ 2 \end{pmatrix}=\begin{pmatrix} 412 \\ 196 \end{pmatrix}\bmod 26=\begin{pmatrix} 22 \\ 14 \end{pmatrix}=\begin{pmatrix} W \\ O \end{pmatrix}[/math]

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} I \\ E \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 8 \\ 4 \end{pmatrix}=\begin{pmatrix} 208 \\ 112 \end{pmatrix}\bmod 26=\begin{pmatrix} 0 \\ 8 \end{pmatrix}=\begin{pmatrix} A \\ I \end{pmatrix}[/math]

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} N \\ C \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 13 \\ 2 \end{pmatrix}=\begin{pmatrix} 302 \\ 146 \end{pmatrix}\bmod 26=\begin{pmatrix} 16 \\ 16 \end{pmatrix}=\begin{pmatrix} Q \\ Q \end{pmatrix}[/math]

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} E \\ O \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 4 \\ 14 \end{pmatrix}=\begin{pmatrix} 200 \\ 152 \end{pmatrix}\bmod 26=\begin{pmatrix} 18 \\ 22 \end{pmatrix}=\begin{pmatrix} S \\ W \end{pmatrix}[/math]

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} L \\ Y \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 11 \\ 24 \end{pmatrix}=\begin{pmatrix} 434 \\ 302 \end{pmatrix}\bmod 26=\begin{pmatrix} 18 \\ 16 \end{pmatrix}=\begin{pmatrix} S \\ Q \end{pmatrix}[/math]

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} M \\ P \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 12 \\ 15 \end{pmatrix}=\begin{pmatrix} 384 \\ 240 \end{pmatrix}\bmod 26=\begin{pmatrix} 20 \\ 6 \end{pmatrix}=\begin{pmatrix} U \\ G \end{pmatrix}[/math]

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} I \\ A \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 8 \\ 0 \end{pmatrix}=\begin{pmatrix} 176 \\ 80 \end{pmatrix}\bmod 26=\begin{pmatrix} 20 \\ 2 \end{pmatrix}=\begin{pmatrix} U \\ C \end{pmatrix}[/math]

[math] \begin{pmatrix} W & I \\ K & I \end{pmatrix}*\begin{pmatrix} D \\ Z \end{pmatrix}=\begin{pmatrix} 22 & 8 \\ 10 & 8 \end{pmatrix}*\begin{pmatrix} 3 \\ 25 \end{pmatrix}=\begin{pmatrix} 226 \\ 230 \end{pmatrix}\bmod 26=\begin{pmatrix} 18 \\ 22 \end{pmatrix}=\begin{pmatrix} S \\ W \end{pmatrix}[/math]

The encoded message is WOAIQQSWSQUGUCSW.

3x3 matrix encryption works in the same way. This example will encrypt "EDIT THE WIKI" using the key "BEE FLY BUG". First, split up the plaintext into groups of three, which becomes EDI TTH EWI KIZ. Once again, the last group has a Z added to make it a group of three.

[math] \begin{pmatrix} B & E & E \\ F & L & Y \\ B & U & G \end{pmatrix}*\begin{pmatrix} E \\ D \\ I \\ \end{pmatrix}=\begin{pmatrix} 1 & 4 & 4 \\ 5 & 11 & 24 \\ 1 & 20 & 6 \end{pmatrix}*\begin{pmatrix} 4 \\ 3 \\ 8 \end{pmatrix}=\begin{pmatrix} 48 \\ 245 \\ 112 \end{pmatrix}\bmod 26=\begin{pmatrix} 22 \\ 11 \\ 8 \end{pmatrix}=\begin{pmatrix} W \\ L \\ I \end{pmatrix}[/math]

[math] \begin{pmatrix} B & E & E \\ F & L & Y \\ B & U & G \end{pmatrix}*\begin{pmatrix} T \\ T \\ H \\ \end{pmatrix}=\begin{pmatrix} 1 & 4 & 4 \\ 5 & 11 & 24 \\ 1 & 20 & 6 \end{pmatrix}*\begin{pmatrix} 19 \\ 19 \\ 7 \end{pmatrix}=\begin{pmatrix} 123 \\ 472 \\ 441 \end{pmatrix}\bmod 26=\begin{pmatrix} 19 \\ 4 \\ 25 \end{pmatrix}=\begin{pmatrix} T \\ E \\ Z \end{pmatrix}[/math]

[math] \begin{pmatrix} B & E & E \\ F & L & Y \\ B & U & G \end{pmatrix}*\begin{pmatrix} E \\ W \\ I \\ \end{pmatrix}=\begin{pmatrix} 1 & 4 & 4 \\ 5 & 11 & 24 \\ 1 & 20 & 6 \end{pmatrix}*\begin{pmatrix} 4 \\ 22 \\ 8 \end{pmatrix}=\begin{pmatrix} 124 \\ 454 \\ 492 \end{pmatrix}\bmod 26=\begin{pmatrix} 20 \\ 12 \\ 24 \end{pmatrix}=\begin{pmatrix} U \\ M \\ Y \end{pmatrix}[/math]

[math] \begin{pmatrix} B & E & E \\ F & L & Y \\ B & U & G \end{pmatrix}*\begin{pmatrix} K \\ I \\ Z \\ \end{pmatrix}=\begin{pmatrix} 1 & 4 & 4 \\ 5 & 11 & 24 \\ 1 & 20 & 6 \end{pmatrix}*\begin{pmatrix} 10 \\ 8 \\ 25 \end{pmatrix}=\begin{pmatrix} 142 \\ 738 \\ 320 \end{pmatrix}\bmod 26=\begin{pmatrix} 12 \\ 10 \\ 8 \end{pmatrix}=\begin{pmatrix} M \\ K \\ I \end{pmatrix}[/math]

The encoded message is WLITEZUMYMKI.

Vigenère Cipher

The Vigenère cipher, invented by Blaise de Vigenère in the 16th century, is a polyalphabetic cipher. This means that each letter is shifted by a different amount. According to the rules, students will probably be asked to encrypt rather than decrypt Vigenère ciphers. Encrypting is a fairly straightforward procedure.

First, write out the message with the key under it, repeating the key as many times as necessary. An example is shown.

Message with Key
Message S C I E N C E O L Y M P I A D I S C O O L
Key S C I O L Y S C I O L Y S C I O L Y S C I

Then, take out the alphabet square, as shown below. This will typically be provided on the test.

Vigenère Alphabet Table

Using the alphabet square, encode the plaintext. The first message letter is S and the first key letter is S, therefore, look at the table to see where row S and column S intersect. It is clear that they intersect at K, so write down K as the first letter of the ciphertext. Repeat this with the rest of the message. Thus, the encrypted text is "KEQSYAW QTMXNACL WD AGQT"

If the key and ciphertext are both given, decoding is also possible. This is done by taking a letter of the key and finding its row, finding the corresponding letter of ciphertext in that row, and seeing what column that letter falls in. The letter in the column is the letter of the plaintext. In the previous example, the first letter is decoded by going to row S and finding K, which is located in column S. Thus, the plaintext letter is S.

Encoding without table

Tables are typically given on the test, but in the event they are not, the following strategy may be more helpful.

Remember or recreate the correspondence between letter and number like in Affine and Hill Cipher, with A being 0 and Z being 25. Then, for each letter, convert the plain text and key to a sequence of numbers, and add the numbers modulo 26. Then, convert the number back to letter.

For example, if we encode the message "SCIENCEOLYMPIADISCOOL" using the key SCIOLY, we get


To decode a message using this method, subtract instead of add the key's corresponding number: The cipher text K with the corresponding key letter S gives plain text [math]10-18=-8\equiv18\pmod{26}\to \text{S}[/math].

Sir Arthur Conan Doyle's Cipher from The Adventure of the Dancing Men

The Dancing Men cipher is a monoalphabetic substitution cipher with spaces where each letter is represented by a dancing man. A man holding a flag indicates the end of a word. In the story, messages encrypted with this cipher were sent to a woman named Elsie, Sherlock Holmes solved the cipher using that E is the most common letter, and that Elsie's name would likely appear. Since the cipher may be easily decrypted if all the dancing men are memorized, there are a few patterns to help remember them. O and A, R and I, and T and E are flipped. T and E are symmetrical about a vertical axis. N and S have the same legs and right arm. The substitution chart is found below.

Dancing Men Cipher

An example of the Dancing Men cipher is listed below.

DancingMenCipherExample.png contains the message "NOTARIES", which conveniently shows the patterns listed above.

External Links

Trial event rules
2016 Nationals
2018 trial rules
Cryptogram Workbook (lots of practice problems, 139 pages)
Mono-alphabetic Substitution Cipher Practice
Game-like Cryptogram Practice
Cipher Tools and Practice Tests