DTTFNB 479 Dszquphsbqiz Announcements n Assignment 2 finalized
DTTF/NB 479: Dszquphsbqiz Announcements: n Assignment 2 finalized Questions? Today: n n Wrap up Hill ciphers One-time pads and LFSR Day 7
Hill Ciphers Lester Hill, 1929. Not used much, but first time linear algebra used in crypto Use an n x n matrix M. Encrypt by breaking plaintext into blocks of length n (padding with x’s if needed) and multiplying each by M. Example: Encrypt “hereissomeonetoencrypt” using M her (7, eis som eon eto enc ryp txx 4, 17) (4, 8, 18) … (2, 5, 25) (0, 2, 22) … cfz acw (19, 23) (0, 22, 15) yga vns ave anc sdd awp “CFZACWYGAVNSAVEANCSDDAWP”
Hill Cipher Demo Encryption n n Easy to do in Matlab. (Otherwise, you’ll need to find/write a matrix library for language X. ) Decryption n n Uses matrix inverse. How do we determine if a matrix is invertible mod 26? Does this cipher exhibit diffusion?
Next: one time pads Back to Vigenere: if the codeword were really long, say 25% as long as the entire plaintext, how many characters would contribute to each dot product? ____ n What does this say about our ability to do a frequency analysis? Now consider the extreme case, the onetime pad…
One-time pads Represent the plaintext in binary, length n n Works for text (from ASCII), images, music, etc The key is a random vector of length n Ciphertext = plaintext XOR key Do n n message = 1000011, key = 1110010 Cipher = ? ? ? ciphertext XOR key = ? ? ?
Unbreakable? Yes, for ciphertext only… Ciphertext: EOFMCKSSDKIVPSSAD Could be: thephoneisringing meetmeinthegarage … I need the whole key to decrypt. What’s the downside to using a one-time pad? Variation: Maurer, Rabin, Ding et al’s satellite method If I’m willing to compromise some security…
Linear Feedback Shift Register (LFSR) Sequences Name comes from hardware implementation Generated bit stream To encrypt plaintext of length n, generate an nbit sequence and XOR with the plaintext. b 1 b 2 b 3 b 4 … bm-1 bm Shift register Feedback function • Need initial conditions (bits in register) and a function to generate more terms. • Example: x 1 = 0, x 2 = 1, x 3 = 0, x 4 = 0, x 5 = 0; xn+5 = xn + xn+2 (mod 2) What does this remind you of in math?
Linear Feedback Shift Register (LFSR) Sequences A recurrence relation! n n Specify initial conditions and coefficients, for example: x 1 = 0, x 2 = 1, x 3 = 0, x 4 = 0, x 5 = 0; xn+5 = xn + xn+2 (mod 2) Another way to write is xn+5 = 1 xn + 0 xn+1 + 1 xn+2 +0 xn+3 + 0 xn+4 (mod 2) In general, Generate some more terms How long until it repeats? (the period of the sequence) n n 10 bits generates ____ bits Demo
Long periods LFSR can generate sequences with long periods n n n Like Vigenere with long key: hard to decrypt! Lots of “bang for the buck”! But it depends on the key Good example: xn+31=xn + xn+3 (mod 2) How many bits do we need to represent this recurrence? n 62 bits How long is the period? n n Over 2 billion! Why? There exist (231 – 1) 31 -bit words Why “-1”? If it cycles through all of these, it’s maximal. Related to Mersenne primes See http: //www. ece. cmu. edu/~koopman/lfsr/index. html for a list of maximalperiod generators Can you devise a bad example (one with period << 2 n-1)?
Linear Feedback Shift Register (LFSR) Sequences Downside: very vulnerable to known plaintext attack. Why? n n Discuss with a partner If time, my example
- Slides: 10