Home > CS178 > Homework 3

Slide(s) will/might/should be posted here later this week.
• Clicky: Representing duplicate letters in a word using a matrix
• Clicky: The big ugly equations

• (Some day I'll learn what scanners are.)

Pre-emptive strike against questions wondering what all those variables mean...
 x crib y isomorph Ny_i Number of times y_i appears in the ENTIRE ciphertext n length of ciphertext r length of isomorph and crib q() onegram value N* The star doesn't really do anything. Think of N* as a variable name q* Same... the star doesn't do anything

Here's the power of monoalphabetic substitution!

```> Can you explain the formula which we shall use to compute x^2

I'll try to post the relevant slides by tomorrow evening.  If it still
doesn't make sense, come to office hours.

> For all letters in crib??

I don't quite understand what your question is.  Yes you do process each
unique letter of the crib.  Keep in mind that every unique letter in the
crib corresponds to a unique letter in the isomorph (that's what makes the
isomorph an isomorph).  And you have to use both the crib and the isomorph

> x1 = sum(for all letters in crib(or is it isomorph?) )

See above.  The isomorph and crib are the same length... so either.

> N(number of times the letter appear in the whole text)

Ya.

> n(total number of letters in the ciphertext)

Ya.

> q(onegm(letter)

Ya.

> So, are we summing for all letters in the crib or the isomorph?

See above.  The isomorph and crib are the same length... so either.

> For letters not in crib??

If you think about X_2^2, you'll see that it's kinda the same thing as the
first, but for letters not in the crib.  Instead of starting from zero and
building up as we did in X_1, we're starting from everything and
subtracting what we know appears (this is just easier).

This means that for X_2 you're again just considering unique letters.  If
your word is "book" and you subtract the same letter twice, that's like
saying "o doesn't occur and o doesn't occur," which is redundant and makes
the math wrong.  For the purposes of scoring, you can ignore all letter
repetitions (they're just useful for identifying isomorphs).
```

```> I was wondering what we needed to turn in for the third homework in terms
> of programs, etc. Thanks.

Don't need to turn in any programs (this will be true for all the
assignments).

You just need to show some cribs, and isomorphs with their
scores and positions for each.

Then, show as much as you can of the substitution.

Lastly, try to decipher the ciphertext.  If you can't find everything,
just show as much as you can get.
```

```> Hey, I have a question about that long equation for calculation X^2.. When
> you are calculating X_1 do you take every letter into account whether a
> repeat or not and then when you calculate X_2, you only take into account the
> unique letters?  I have written the program and have been searching for cribs
> but I have something wrong and I am trying to figure out what it is.. I hope
> this helps! :)

For both X_1 and X_2 you are only calculating with respect to individual
(unique) letters.  So for "bookmark" you would do "bokmar". [sic]

Calculating the X score takes into consideration the counts of letters
that appear in the ciphertext, so if at any time you use the same letter
twice, you are skewing the results (and that will probably give you the