SlideShare uma empresa Scribd logo
1 de 41
Class 20: Running Time




                cs1120 Fall 2011
                David Evans
                7 October 2011
Image by Jonathan Mak   2
3
Next House, MIT




                  4
Whole Earth Epilog, 1974
                           “On the back cover of their
                           final issue was a
                           photograph of an early
                           morning country road, the
                           kind you might find yourself
                           hitchhiking on if you were
                           so adventurous. Beneath it
                           were the words: “Stay
                           Hungry. Stay Foolish.” It
                           was their farewell message
                           as they signed off. Stay
                           Hungry. Stay Foolish. And I
                           have always wished that
                           for myself.”
                               Steve Job’s 2005 Stanford
                               Commencement Speech
                                                           5
Turing Machines




    One of the deep mysteries to me is our logo, the
    symbol of lust and knowledge, bitten into, all
    crossed with the colors of the rainbow in the wrong
    order. You couldn’t dream a more appropriate logo:
    lust, knowledge, hope and anarchy.
                                       Jean-Louis Gassée

                                                           6
Last Class: TM for Unary >
Input:    1a>1b#
Output:   #1 if a > b, #0 otherwise.




                                       7
Transition Rules
(CrossOne, 1) -> (LookForGT, X, R)    ; found a 1 in a, look for a 1 in b to cross off
(CrossOne, >) -> (Write0Out, #, R)    ; no more 1's in a, so a <= b

(LookForGT, 1) -> (LookForGT, 1, R)   ; keep looking
(LookForGT, >) -> (LookForB1, >, R)   ; found the >

(LookForB1, X) -> (LookForB1, X, R)   ; keep looking
(LookForB1, 1) -> (GoBack, X, L)      ; crossed off match, return for next
(LookForB1, #) -> (Write1Out, #, R)   ; no match, a > b

(GoBack, X) -> (GoBack, X, L)         ; keep looking for >
(GoBack, >) -> (Reset, >, L)          ; now, look for the rightmost X

(Reset, 1) -> (Reset, 1, L)           ; keep looking for X
(Reset, X) -> (CrossOne, X, R)        ; found it!

(Write0Out, *) -> (Halt, 0, HALT)
(Write1Out, *) -> (Halt, 1, HALT)

                                                                                         8
(CrossOne, 1) -> (LookForGT, X, R)                                                              (GoBack, X) -> (GoBack, X, L)
(CrossOne, >) -> (Write0Out, #, R)                                                              (GoBack, >) -> (Reset, >, L)
(LookForGT, 1) -> (LookForGT, 1, R)                                                             (Reset, 1) -> (Reset, 1, L)
(LookForGT, >) -> (LookForB1, >, R)                                                             (Reset, X) -> (CrossOne, X, R)
(LookForB1, X) -> (LookForB1, X, R)                           1/1,                              (Write0Out, *) -> (Halt, 0, HALT)
(LookForB1, 1) -> (GoBack, X, L)                                                                (Write1Out, *) -> (Halt, 1, HALT)
(LookForB1, #) -> (Write1Out, #, R)

                                                       Look
                                      1/X,                                                                X/X,
                                                        For                            Look
                                                        GT           >/>,               For
                        Cross                                                           B1
  Start                                                                                                #/#,
                        One                                                    1/X,
                                                          >/>,

                                                Reset                   Go
        >/#,                    X/X,                                   Back
                                                                                                          Write
                                                                                                          1 Out
               Write
                                                1/1,                    X/X,
               0 Out
                                      /0,Halt                                         /1,Halt

                                                               HALT
                                                                                                                      9
Binary >
Input:     a>b#
Output: #1 if the value a interpreted as a
  binary number is greater than the value of b
  interpreted as a binary number, #0 otherwise.




                                                  10
1/1,


                                            Look
                           1/X,                                                       X/X,
                                             For                            Look
                                             GT           >/>,               For
                   Cross                                                     B1
Start                                                                                #/#,
                   One                                              1/X,
                                               >/>,

                                     Reset                   Go
    >/#,               X/X,                                 Back                      Write
                                                                                      1 Out
           Write
                                     1/1,                    X/X,
           0 Out
                           /0,Halt                                         /1,Halt

                                                    HALT
                                                                                              11
1/1,
                                            0/0,
                                                                                     X/X,
                              Look                                      Look
                               For            >/>,                       For                    #/#,
                              GT-0                                       B-0
                                                   1/1,                             1/X,
                                                          0/0,             0/X,
           0/X,
                                            Look
                           1/X,                                                                X/X,
                                             For                                  Look
                                             GT       >/>,                         For
                   Cross                                                           B1
Start                                                                                         #/#,
                   One
                                               >/>,                     1/X,

                                     Reset                    Go
    >/#,               X/X,                                  Back                              Write
                                                                                               1 Out
           Write
                                     1/1,                        X/X,               /1,Halt
           0 Out
                           /0,Halt                                         Lots more changes needed…
                                                                           but you get the idea
                                                     HALT
                                                                                                       12
“Sensible” Algorithm Analysis
Writing TM programs is long and tedious
  (and, at least for normal size inputs, does not
  correspond well to what a real machine does for
  simple operations)
Common Simplifying Assumptions
  Arithmetic operations are constant time
      This is true if numbers are bounded
      Cannot be true for arbitrarily large numbers

                                                     13
What’s Coming Next
Chapter 7: Cost
Chapter 8: Searching and Sorting
  We’ll do lots of examples in class also

Chapter 9: Mutation (PS5)
Chapter 10: Objects (PS6)
  Ways to program more expressively

                                            14
Breaking Lorenz




                  15
One-Time Pad

   C=M                             K
Claude Shannon, A Mathematical Theory of
Cryptography, 1946 (declassified later): Proved
that a one-time pad is a perfect cipher!          Frank Miller 1882




                                         PS4, Question 3!
                                                                      16
Why perfectly secure?
For any given ciphertext, all plaintexts are
equally possible.

Ciphertext:           J = 01001
Key1:                 I = 00110
Plaintext1:               01111 = K
Key2:                 L = 10010
Plaintext2:             = 11011 = shift
Vernam’s One-Time Pad (1919)
A long paper tape with random
   letters on it (using Baudot
   code)
Cannot reuse key – tape must be
   very long!



            This has 6 holes per letter
                    (not Baudot code)
Lorenz Cipher
Based on the Vernam and Morehouse machines
  Used Baudot code
Believed managing long paper tapes during
  wartime was too difficult
Machine generates key sequence
  If two machines start in same configuration, same key
     sequence
  Will not repeat for ~ 1019 letters
     All words ever written by all humans is 1018 letters
HQIBPEXEZMUG!
May 1941: GCHQ learns about first
 Fish link (Tunny)
     Intercepted unencrypted
     Baudot-encoded test messages

August 30, 1941:                                 GCHQ Today
                                        (not what it looked like in 1941!)
   Operator retransmits failed message
     with same starting configuration
   Gets lazy and uses some
     abbreviations, makes some        SPRUCHNUMMER/SPRUCHNR
                                             (Serial Number)
     mistakes

                                                                        21
“Two Time” Pad
Allies have intercepted:
    C1 = M1 K1
    C2 = M2 K1
  Same key used for both (same starting configuration)




                                                         22
“Cribs”
Know: C1, C2 (intercepted ciphertext)
         C1 C2 = M1 M2
Don’t know M1 or M2
   Can make some guesses (cribs)
      SPRUCHNUMMER
        Sometimes allies moved ships, sent out bombers to help the
        cryptographers get good cribs
Given guess for M1, calculate M2
     M2 = C1     C2     M1
If M2 seems plausible, calculate key:
     K1 = M1     C1 = M2       C2


                                                                     23
Learning the Key
From the 2 intercepted
  messages, Col. John Tiltman
  worked on guessing cribs to
  find M1 and M2

4000 letter messages
Found 4000 letter key K1


                                24
Reverse Engineering Lorenz
Major G. W. Morgan to Bill Tutte
  (recent Chemistry graduate):
  “See what you can do with
  this.” (Tiltman’s K1)
Found period of 574 = 41 14
Six months later new machine
  structure likely to generate K1

                              Bill Tutte
                           U. Waterloo
                           (1917-2002)
                                           25
Lorenz Structure




        Main weakness: each step, either all
        S wheels turn, or none of them do!


                                               26
Intercepting Traffic
Set up listening post to intercept traffic from 12
  Lorenz (Fish) links
  Different links between Berlin and conquered capitals
  Slightly different coding procedures, and different
     configurations
600 people worked
  on intercepting traffic



                                                          27
Breaking Traffic
Knew machine structure, but a different initial
  configuration was used for each message
Need to determine wheel setting:
  Initial position of each of the 12 wheels
  Needed to try them fast enough to decrypt message
    while it was still strategically valuable



       This is what you did for PS4 (except with fewer wheels)


                                                                 28
Recognizing a Good Guess
Intercepted Message (divided into 5 channels for
  each Baudot code bit)
    Zc = z0z1z2z3z4z5z6z7…
    zc, i = mc,i xc,i sc,i
       Message Key (parts from S-wheels and rest)
Look for statistical properties
  How many of the zc,i’s are 0?                ½ (not useful)
  How many of (zc,i+1 zc,i) are 0?             ½

                                                                29
Double Delta
              Zc,i = Zc,i   Zc,i+1
Combine two channels:
    Z1,i     Z2,i =     M1,i     M2,i > ½ Yippee!
                         X1,i     X2,i = ½ (key)
                         S1,i    S2,i > ½ Yippee!
 Why is M1,i          M2,i > ½
       Message is in German, more likely following
       letter is a repetition than random
 Why is S1,i         S2,i > ½
       S-wheels only turn when M-wheel is 1
                                                     30
Actual Advantage
Probability of repeating letters
  Prob[ M1,i        M2,i = 0] 0.614
    3.3% of German digraphs are repeating
Probability of repeating S-keys
  Prob[ S1,i       S2,i = 0] ~ 0.73
Prob[ Z1,i       Z2,i         X1,i         X2,i = 0]
  = 0.614 * 0.73         + (1-0.614) * (1-0.73)
     M and S are 0             M and S are 1
 = 0.55 if the wheel settings guess is correct (0.5 otherwise)
                                                                 31
Using the Advantage
If the guess of X is correct, should see higher than ½
   of the double deltas are 0
Try guessing different configurations to find highest
   number of 0 double deltas
Problem:
   # of double delta operations to try one config
   = length of Z * length of X
   = for 10,000 letter message
       1271 settings * 7 per double delta
   = 89 M operations

                                                         32
Heath Robinson
Dec 1942: Decide to build a
   machine to do these s
   quickly, due June 1943
Apr 1943: first Heath Robinson
   machine is delivered!
Intercepted ciphertext on tape:
   2000 characters per second (12
     miles per hour)
   Needed to perform 7 operations
     each ½ ms



                               Heath Robinson, British Cartoonist (1872-1944)

                                                                                33
Colossus
Heath Robinson machines were too slow
Colossus designed and first built in Jan 1944
Replaced keytext tape loop with electronic keytext
  generator
Speed up ciphertext tape:
   5,000 chars per second = 30 mph
   Perform 5 double deltas simultaneously
   Speedup = 2.5X for faster tape 5X for parallelism



                                                       34
Colossus Design                   Ciphertext Tape




Electronic
 Keytext       Logic                Tape Reader
Generator



              Counter             Position Counter




                        Printer


                                                     35
Impact on WWII
10 Colossus machines operated at Bletchley
Decoded 63 million letters in Nazi messages
Learned German troop locations to plan D-Day




                                               36
Colossus History
Kept secret after the war, all machines destroyed




   During WWII                 Rebuilt (Summer 2004)
                                                       37
How could Bletchley Park solve a problem
  a quintillion times harder than PS4?




                                     38
Poster in RAF Museum
                       39
Confronted with the prospect
of defeat, the Allied
cryptanalysts had worked night
and day to penetrate German
ciphers. It would appear that
fear was the main driving force,
and that adversity is one of the
foundations of successful
codebreaking.
    Simon Singh, The Code Book

                                   40
Charge
No problem on your exam is one quintillionth as hard
  as breaking Lorenz!
      No real fear or adversity should be necessary
      to solve the exam problems.
Exam 1: Out Now
  Due at beginning of class Wednesday
Stay Hungry! Stay Foolish!
  Watch or read Steve Jobs’ Commencement Speech

                                                       41

Mais conteúdo relacionado

Mais de David Evans

Mining Economics
Mining EconomicsMining Economics
Mining EconomicsDavid Evans
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More ParanoidDavid Evans
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key SignaturesDavid Evans
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to CryptographyDavid Evans
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?David Evans
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the MassesDavid Evans
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of ReserveDavid Evans
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!David Evans
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinDavid Evans
 
Alternate Cryptocurrencies
Alternate CryptocurrenciesAlternate Cryptocurrencies
Alternate CryptocurrenciesDavid Evans
 
Quiz 2: Bitcoin Protocol, Mining, Supsersizing
Quiz 2: Bitcoin Protocol, Mining, SupsersizingQuiz 2: Bitcoin Protocol, Mining, Supsersizing
Quiz 2: Bitcoin Protocol, Mining, SupsersizingDavid Evans
 
Mostly About Superfish
Mostly About SuperfishMostly About Superfish
Mostly About SuperfishDavid Evans
 
Mining Pools and Profits
Mining Pools and ProfitsMining Pools and Profits
Mining Pools and ProfitsDavid Evans
 

Mais de David Evans (20)

Bitcoin Script
Bitcoin ScriptBitcoin Script
Bitcoin Script
 
Mining Economics
Mining EconomicsMining Economics
Mining Economics
 
Mining
MiningMining
Mining
 
The Blockchain
The BlockchainThe Blockchain
The Blockchain
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More Paranoid
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key Signatures
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the Masses
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of Reserve
 
Silk Road
Silk RoadSilk Road
Silk Road
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, Permacoin
 
Alternate Cryptocurrencies
Alternate CryptocurrenciesAlternate Cryptocurrencies
Alternate Cryptocurrencies
 
Script
ScriptScript
Script
 
Selfish Mining
Selfish MiningSelfish Mining
Selfish Mining
 
Quiz 2: Bitcoin Protocol, Mining, Supsersizing
Quiz 2: Bitcoin Protocol, Mining, SupsersizingQuiz 2: Bitcoin Protocol, Mining, Supsersizing
Quiz 2: Bitcoin Protocol, Mining, Supsersizing
 
Mostly About Superfish
Mostly About SuperfishMostly About Superfish
Mostly About Superfish
 
Mining Pools and Profits
Mining Pools and ProfitsMining Pools and Profits
Mining Pools and Profits
 
More Mining
More MiningMore Mining
More Mining
 

Último

CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣anilsa9823
 
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdfTAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdfSocial Samosa
 
Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...
Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...
Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...Eticketing.co
 
Plan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby fémininPlan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby fémininThibaut TATRY
 
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdfJORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdfArturo Pacheco Alvarez
 
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...World Wide Tickets And Hospitality
 
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...Diya Sharma
 
08448380779 Call Girls In International Airport Women Seeking Men
08448380779 Call Girls In International Airport Women Seeking Men08448380779 Call Girls In International Airport Women Seeking Men
08448380779 Call Girls In International Airport Women Seeking MenDelhi Call girls
 
Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024HechemLaameri
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual serviceanilsa9823
 
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai EbonyDubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebonyhf8803863
 
VIP Kolkata Call Girl Liluah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Liluah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Liluah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Liluah 👉 8250192130 Available With Roomdivyansh0kumar0
 
08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking Men08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking Men08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking MenDelhi Call girls
 
ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024Brian Slack
 
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改atducpo
 
大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改
大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改
大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改atducpo
 

Último (20)

CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣
 
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdfTAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
 
Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...
Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...
Italy vs Albania Tickets: Italy's Quest for Euro Cup Germany History, Defendi...
 
Call Girls 🫤 Paharganj ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
Call Girls 🫤 Paharganj ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOYCall Girls 🫤 Paharganj ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOY
Call Girls 🫤 Paharganj ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
 
Plan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby fémininPlan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby féminin
 
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdfJORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
 
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
 
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
 
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
 
08448380779 Call Girls In International Airport Women Seeking Men
08448380779 Call Girls In International Airport Women Seeking Men08448380779 Call Girls In International Airport Women Seeking Men
08448380779 Call Girls In International Airport Women Seeking Men
 
Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service
 
Call Girls In Vasundhara 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Vasundhara 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Vasundhara 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Vasundhara 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai EbonyDubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
 
VIP Kolkata Call Girl Liluah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Liluah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Liluah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Liluah 👉 8250192130 Available With Room
 
08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking Men08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking Men
 
08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking Men08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking Men
 
ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024
 
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
 
大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改
大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改
大学学位办理《原版美国USD学位证书》圣地亚哥大学毕业证制作成绩单修改
 

Lecture20

  • 1. Class 20: Running Time cs1120 Fall 2011 David Evans 7 October 2011
  • 3. 3
  • 5. Whole Earth Epilog, 1974 “On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: “Stay Hungry. Stay Foolish.” It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I have always wished that for myself.” Steve Job’s 2005 Stanford Commencement Speech 5
  • 6. Turing Machines One of the deep mysteries to me is our logo, the symbol of lust and knowledge, bitten into, all crossed with the colors of the rainbow in the wrong order. You couldn’t dream a more appropriate logo: lust, knowledge, hope and anarchy. Jean-Louis Gassée 6
  • 7. Last Class: TM for Unary > Input: 1a>1b# Output: #1 if a > b, #0 otherwise. 7
  • 8. Transition Rules (CrossOne, 1) -> (LookForGT, X, R) ; found a 1 in a, look for a 1 in b to cross off (CrossOne, >) -> (Write0Out, #, R) ; no more 1's in a, so a <= b (LookForGT, 1) -> (LookForGT, 1, R) ; keep looking (LookForGT, >) -> (LookForB1, >, R) ; found the > (LookForB1, X) -> (LookForB1, X, R) ; keep looking (LookForB1, 1) -> (GoBack, X, L) ; crossed off match, return for next (LookForB1, #) -> (Write1Out, #, R) ; no match, a > b (GoBack, X) -> (GoBack, X, L) ; keep looking for > (GoBack, >) -> (Reset, >, L) ; now, look for the rightmost X (Reset, 1) -> (Reset, 1, L) ; keep looking for X (Reset, X) -> (CrossOne, X, R) ; found it! (Write0Out, *) -> (Halt, 0, HALT) (Write1Out, *) -> (Halt, 1, HALT) 8
  • 9. (CrossOne, 1) -> (LookForGT, X, R) (GoBack, X) -> (GoBack, X, L) (CrossOne, >) -> (Write0Out, #, R) (GoBack, >) -> (Reset, >, L) (LookForGT, 1) -> (LookForGT, 1, R) (Reset, 1) -> (Reset, 1, L) (LookForGT, >) -> (LookForB1, >, R) (Reset, X) -> (CrossOne, X, R) (LookForB1, X) -> (LookForB1, X, R) 1/1, (Write0Out, *) -> (Halt, 0, HALT) (LookForB1, 1) -> (GoBack, X, L) (Write1Out, *) -> (Halt, 1, HALT) (LookForB1, #) -> (Write1Out, #, R) Look 1/X, X/X, For Look GT >/>, For Cross B1 Start #/#, One 1/X, >/>, Reset Go >/#, X/X, Back Write 1 Out Write 1/1, X/X, 0 Out /0,Halt /1,Halt HALT 9
  • 10. Binary > Input: a>b# Output: #1 if the value a interpreted as a binary number is greater than the value of b interpreted as a binary number, #0 otherwise. 10
  • 11. 1/1, Look 1/X, X/X, For Look GT >/>, For Cross B1 Start #/#, One 1/X, >/>, Reset Go >/#, X/X, Back Write 1 Out Write 1/1, X/X, 0 Out /0,Halt /1,Halt HALT 11
  • 12. 1/1, 0/0, X/X, Look Look For >/>, For #/#, GT-0 B-0 1/1, 1/X, 0/0, 0/X, 0/X, Look 1/X, X/X, For Look GT >/>, For Cross B1 Start #/#, One >/>, 1/X, Reset Go >/#, X/X, Back Write 1 Out Write 1/1, X/X, /1,Halt 0 Out /0,Halt Lots more changes needed… but you get the idea HALT 12
  • 13. “Sensible” Algorithm Analysis Writing TM programs is long and tedious (and, at least for normal size inputs, does not correspond well to what a real machine does for simple operations) Common Simplifying Assumptions Arithmetic operations are constant time This is true if numbers are bounded Cannot be true for arbitrarily large numbers 13
  • 14. What’s Coming Next Chapter 7: Cost Chapter 8: Searching and Sorting We’ll do lots of examples in class also Chapter 9: Mutation (PS5) Chapter 10: Objects (PS6) Ways to program more expressively 14
  • 16. One-Time Pad C=M K Claude Shannon, A Mathematical Theory of Cryptography, 1946 (declassified later): Proved that a one-time pad is a perfect cipher! Frank Miller 1882 PS4, Question 3! 16
  • 17. Why perfectly secure? For any given ciphertext, all plaintexts are equally possible. Ciphertext: J = 01001 Key1: I = 00110 Plaintext1: 01111 = K Key2: L = 10010 Plaintext2: = 11011 = shift
  • 18. Vernam’s One-Time Pad (1919) A long paper tape with random letters on it (using Baudot code) Cannot reuse key – tape must be very long! This has 6 holes per letter (not Baudot code)
  • 19. Lorenz Cipher Based on the Vernam and Morehouse machines Used Baudot code Believed managing long paper tapes during wartime was too difficult Machine generates key sequence If two machines start in same configuration, same key sequence Will not repeat for ~ 1019 letters All words ever written by all humans is 1018 letters
  • 20.
  • 21. HQIBPEXEZMUG! May 1941: GCHQ learns about first Fish link (Tunny) Intercepted unencrypted Baudot-encoded test messages August 30, 1941: GCHQ Today (not what it looked like in 1941!) Operator retransmits failed message with same starting configuration Gets lazy and uses some abbreviations, makes some SPRUCHNUMMER/SPRUCHNR (Serial Number) mistakes 21
  • 22. “Two Time” Pad Allies have intercepted: C1 = M1 K1 C2 = M2 K1 Same key used for both (same starting configuration) 22
  • 23. “Cribs” Know: C1, C2 (intercepted ciphertext) C1 C2 = M1 M2 Don’t know M1 or M2 Can make some guesses (cribs) SPRUCHNUMMER Sometimes allies moved ships, sent out bombers to help the cryptographers get good cribs Given guess for M1, calculate M2 M2 = C1 C2 M1 If M2 seems plausible, calculate key: K1 = M1 C1 = M2 C2 23
  • 24. Learning the Key From the 2 intercepted messages, Col. John Tiltman worked on guessing cribs to find M1 and M2 4000 letter messages Found 4000 letter key K1 24
  • 25. Reverse Engineering Lorenz Major G. W. Morgan to Bill Tutte (recent Chemistry graduate): “See what you can do with this.” (Tiltman’s K1) Found period of 574 = 41 14 Six months later new machine structure likely to generate K1 Bill Tutte U. Waterloo (1917-2002) 25
  • 26. Lorenz Structure Main weakness: each step, either all S wheels turn, or none of them do! 26
  • 27. Intercepting Traffic Set up listening post to intercept traffic from 12 Lorenz (Fish) links Different links between Berlin and conquered capitals Slightly different coding procedures, and different configurations 600 people worked on intercepting traffic 27
  • 28. Breaking Traffic Knew machine structure, but a different initial configuration was used for each message Need to determine wheel setting: Initial position of each of the 12 wheels Needed to try them fast enough to decrypt message while it was still strategically valuable This is what you did for PS4 (except with fewer wheels) 28
  • 29. Recognizing a Good Guess Intercepted Message (divided into 5 channels for each Baudot code bit) Zc = z0z1z2z3z4z5z6z7… zc, i = mc,i xc,i sc,i Message Key (parts from S-wheels and rest) Look for statistical properties How many of the zc,i’s are 0? ½ (not useful) How many of (zc,i+1 zc,i) are 0? ½ 29
  • 30. Double Delta Zc,i = Zc,i Zc,i+1 Combine two channels: Z1,i Z2,i = M1,i M2,i > ½ Yippee! X1,i X2,i = ½ (key) S1,i S2,i > ½ Yippee! Why is M1,i M2,i > ½ Message is in German, more likely following letter is a repetition than random Why is S1,i S2,i > ½ S-wheels only turn when M-wheel is 1 30
  • 31. Actual Advantage Probability of repeating letters Prob[ M1,i M2,i = 0] 0.614 3.3% of German digraphs are repeating Probability of repeating S-keys Prob[ S1,i S2,i = 0] ~ 0.73 Prob[ Z1,i Z2,i X1,i X2,i = 0] = 0.614 * 0.73 + (1-0.614) * (1-0.73) M and S are 0 M and S are 1 = 0.55 if the wheel settings guess is correct (0.5 otherwise) 31
  • 32. Using the Advantage If the guess of X is correct, should see higher than ½ of the double deltas are 0 Try guessing different configurations to find highest number of 0 double deltas Problem: # of double delta operations to try one config = length of Z * length of X = for 10,000 letter message 1271 settings * 7 per double delta = 89 M operations 32
  • 33. Heath Robinson Dec 1942: Decide to build a machine to do these s quickly, due June 1943 Apr 1943: first Heath Robinson machine is delivered! Intercepted ciphertext on tape: 2000 characters per second (12 miles per hour) Needed to perform 7 operations each ½ ms Heath Robinson, British Cartoonist (1872-1944) 33
  • 34. Colossus Heath Robinson machines were too slow Colossus designed and first built in Jan 1944 Replaced keytext tape loop with electronic keytext generator Speed up ciphertext tape: 5,000 chars per second = 30 mph Perform 5 double deltas simultaneously Speedup = 2.5X for faster tape 5X for parallelism 34
  • 35. Colossus Design Ciphertext Tape Electronic Keytext Logic Tape Reader Generator Counter Position Counter Printer 35
  • 36. Impact on WWII 10 Colossus machines operated at Bletchley Decoded 63 million letters in Nazi messages Learned German troop locations to plan D-Day 36
  • 37. Colossus History Kept secret after the war, all machines destroyed During WWII Rebuilt (Summer 2004) 37
  • 38. How could Bletchley Park solve a problem a quintillion times harder than PS4? 38
  • 39. Poster in RAF Museum 39
  • 40. Confronted with the prospect of defeat, the Allied cryptanalysts had worked night and day to penetrate German ciphers. It would appear that fear was the main driving force, and that adversity is one of the foundations of successful codebreaking. Simon Singh, The Code Book 40
  • 41. Charge No problem on your exam is one quintillionth as hard as breaking Lorenz! No real fear or adversity should be necessary to solve the exam problems. Exam 1: Out Now Due at beginning of class Wednesday Stay Hungry! Stay Foolish! Watch or read Steve Jobs’ Commencement Speech 41