Fall2011+Week+2

Let's use the book, now that we all have it. I have more problems to add, but I don't have my book with me. So, look for more problems to try Friday night. Page 55 1 - 17, 24 Enjoy those little easy ones! Page 59 1 - 7, 10 are worth doing. Share the load - there's lots of repeated topics here. For the computer problems, you don't have to use C# like Ian. You can use Word for substitutions using Find and Replace.

p 55 #2 α=9, β=2 plaintext for U (U=20): y=9x+2 mod 26 20=9x+2 mod 26 18=9x mod 26 x=2=c plaintext for C (C=2) 2=9x+2 mod 26 0=9x mod 26 x=0=a plaintext for R (R=17) 17=9x+2 15≡171=9x x=19=t

plaintext: cat user:kml003

p.55 #5 ciphertext: CRWWZ plaintext starts with ha α(7) + β = 2 __-(α(0) + β = 17)__ 7α = -15 ≡ 11 (mod 26) α = 9 β = 17 y = 9x + 17 (1/9)(y – 17) = x gcd(9, 26) ≡ 1 9*3 ≡ 1 (mod 26) so substitute 3 in for 1/9 x ≡ 3(y – 17) ≡ 3y – 51 ≡ 3y + 1 (mod 26)

C (=2) maps to 3(2) + 1 ≡ 7 (mod 26) or h R (=17) maps to 3(17) + 1 ≡ 52 ≡ 0 (mod 26) or a  W (=22) maps to 3(22) + 1 ≡ 67 ≡ 15 (mod 26) or p (and you need two of these) Z (=25) maps to 3(25) + 1 ≡ 76 ≡ 24 (mod 26) or y

Plaintext: happy user:meganternes

p.55 #10: ciphertext: BABABAAABA key length: 2 (either aa, bb, ab, or ba) frequency vector A0=(.1, .9) after one shift A1=(.9, .1) V1=(#of A's, #of B's for first letter of key)=(1, 4) ->divide this by 5total (5) to get freq vector = (.2, .8) V1 dotted with A0 = .74, V1 dotted with A1 = .26 so no shift occured in the first letter of the key, making it 0 or a

V2=(#of A's, # of B's for the second letter of key)=(5, 0)/5 = (1, 0) V2 dotted with A0=.1, V2 dotted with A1=.9 so one shift occured in the second letter of the key, making it a 1 or b

Key=ab, plaintext=bbbbbbabbb user:bea001

p.55 #11 ciphertext: ABCBABBBAC frequency vector A0 = (.7, .2, .1) frequency vector A1 = (.1, .7, .2) frequency vector A2 = (.2, .1, .7)

if key length is 1, V1 = (# of A's, # of B's, # of C's in 1st letter of key) = (3, 5, 2) divide by 10 (the # of 1st letters); freq. vector = (.3, .5, .2) V1 dot A0 = .33 V1 dot A1 = .42 V1 dot A2 = .25 if key length is 1, the text was shifted 1, so the key would be B. plaintext would be cabacaaacb which doesn't match the given frequency (.7, .2, .1)

if key length is 2, V1 = (# of A's, # of B's, # of C's in 1st letter of key) = (3, 1, 1) divide by 5; freq. vector = (.6, .2, .2) V2 = (# of A's, # of B's, # of C's in 2nd letter of key) = (0, 4, 1) divide by 5; freq. vector = (0, .8, .2) V1 dot A0 = .48 V1 dot A1 = .24 V1 dot A2 = .28 V2 dot A0 = .18 V2 dot A1 = .6 V2 dot A2 = .22 if key length is 2, the 1st letter was not shifted, so the key would be A. the 2nd letter was shifted by 1, so the 2nd key letter is B. plaintext would be aacaaabaab. this matches the (.7, .2, .1) frequency.

if key length is 3, V1 = (1, 2, 0) divide that by 3; freq. vector = (1/3, 2/3, 0) V2 = (1, 2, 0) divide by 3; freq. vector = (1/3, 2/3, 0) V3 = (1, 1, 1) divide by 3; freq. vector = (1/3, 1/3, 1/3) V1 (and V2) dot A0 = .366666667 V1 (and V2) dot A1 = .5 V1 (and V2) dot A2 = .13333333 V3 dot A0 (A1, and A2) = .333333333333 if key length was 3, the 1st and 2nd letters of the key would be B and the 3rd letter has equal chance of being A, B or C.

The key length of 2 seems most likely with the key being AB. user:meganternes

#13: ciphertext: YIFZMA = (24 8)(5 25)(12 0) M=9 13 inverse of M= 3 13 2 3 24 9

(24 8)*inverse = (4 20) = eu (5 25)*inverse = (17 4) = re  (12 0)*inverse = (10 0) = ka  eureka! user:bea001 p55 #15 From the first chosen plaintext,α(1)+B(0)=7 and γ(1)+δ (0)=2, so α=7 and γ=2 From the second chosen plaintext, 7(25)+B(25)=6 and 2(25)+δ(25)=19

6=175+25Β mod 26 -169≡ 325=25Β Β=13

19=50+25δ -31≡ 125=25δ δ=5

(7 13 2 5 ) = M  user:kml003

#17: M= 1 2 3 4 (1 1)*M = (4 6) 4 congruent to 30 mod 26, 6 congruent to 32 mod 26 (a b)*M=(30 32) a=? b=? a+3b=30, 2a+4b=32 a=b=14 (14 14)*M=(4 6) user:bea001

McDaniel, I'm trying the computer ones with find & replace, but once I replace a letter, it gets re-replaced later on in the alphabet. What's the best way to do that? user:kml003 Kayla, use Case-sensitive Find and Replace. Make the cipher text all lower case, then substitute into upper case. Then your substituted B's will stay B's when the lowercase b's become K's, or whatever. user:mcdaniel30

There is an option to make Word's find and replace function case-sensitive. Try doing that user:ian.hart

pg 59 # 8, got my Vigenere code worked out, I believe. From the cipher text in the book I decrypted the following plain text: HOLMESHADBEENSEATEDFORSOMEHOURSINSILENCEWITHHISLONGTHINBACKCURVEDOVERACHEMICALVESSEL INWHICHHEWASBREWINGAPARTICULARLYMALODOROUSPRODUCTHISHEADWASSUNKUPONHISBREAST ANDHELOOKEDFROMMYPOINTOFVIEWLIKEASTRANGELANKBIRDWITHDULLGREYPLUMAGEANDABLACKTOPKNOT SOWATSONSAIDHESUDDENLYYOUDONOTPROPOSETOINVESTINSOUTHAFRICANSECURITIES

FHHKNDGCAGVLFSPCMATWBZQXLCUCNDMIKRBKCLKUOWTAFGWKCWQFOMONTZ

The text became gibberish after a point, which I separated above. Not sure if this is a programming error or not. The encryption text was HOLMES (surprise). user:ian.hart

pg 59 # 10 Tried this one, but I didn't have much luck. The inverse matrix I got is below: -8, 2, 5, 0 -86, -116, 40, 55 37, 54, -19, -22 -16, -29, 10, 11

The best I got out of the message was an FYI at the beginning and then a lot of useless consonants. Anyone do any better? Also, can I reduce the matrix rows (mod 26)? user:ian.hart Ian, I'm looking into your two weird hassles.user:mcdaniel30