the somewhat simplified solitaire algorithmmccann/research/solitaire... · 2006. 3. 8. · the...
TRANSCRIPT
![Page 1: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/1.jpg)
The Somewhat SimplifiedSolitaire Algorithm
Lester I. [email protected]
Computer Science DepartmentThe University of Arizona
Tucson, AZ
ACM SIGCSE Nifty Assignments PanelMarch 4, 2006
SIGCSE 2006 – p.1/21
![Page 3: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/3.jpg)
Who Is This Guy?
Best-selling Author Neal Stephensonhttp://www.nealstephenson.com
SIGCSE 2006 – p.2/21
![Page 4: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/4.jpg)
What Has He Written?
(among others)
SIGCSE 2006 – p.3/21
![Page 5: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/5.jpg)
Cryptonomicon
(c) 1999
• A Combination of Historical& Modern-Day Fiction
SIGCSE 2006 – p.4/21
![Page 6: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/6.jpg)
Cryptonomicon
(c) 1999
• A Combination of Historical& Modern-Day Fiction
• Threads Joined ByCryptography
SIGCSE 2006 – p.4/21
![Page 7: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/7.jpg)
Cryptonomicon
(c) 1999
• A Combination of Historical& Modern-Day Fiction
• Threads Joined ByCryptography
• And After ∼ 800 pages . . .
SIGCSE 2006 – p.4/21
![Page 8: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/8.jpg)
Cryptonomicon
(c) 1999
• A Combination of Historical& Modern-Day Fiction
• Threads Joined ByCryptography
• And After ∼ 800 pages . . .
• . . . The Pontifex Transform IsUsed
SIGCSE 2006 – p.4/21
![Page 9: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/9.jpg)
Pontifex == Solitaire
www.schneier.com
• In reality, Pontifex is really security expert BruceSchneier’s Solitaire cryptosystem.
• Schneier describes it in Cryptonomicon’s appendix
SIGCSE 2006 – p.5/21
![Page 10: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/10.jpg)
Solitaire? A Cryptosystem??
SIGCSE 2006 – p.6/21
![Page 11: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/11.jpg)
Solitaire? A Cryptosystem??
No, not that Solitaire . . .
SIGCSE 2006 – p.6/21
![Page 12: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/12.jpg)
Bruce Schneier’s Solitaire
• So named because it is based on manipulations ofplaying cards
SIGCSE 2006 – p.7/21
![Page 13: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/13.jpg)
Bruce Schneier’s Solitaire
• So named because it is based on manipulations ofplaying cards
◦ Who would question an innocent deck of cards?
SIGCSE 2006 – p.7/21
![Page 14: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/14.jpg)
As Tested on MythBusters!
by Ricky Jay, (c) 1977
SIGCSE 2006 – p.8/21
![Page 15: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/15.jpg)
Bruce Schneier’s Solitaire
• So named because it is based on manipulations ofplaying cards
◦ Who would question an innocent deck of cards?. . . OK, we’ll ignore that.
SIGCSE 2006 – p.9/21
![Page 16: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/16.jpg)
Bruce Schneier’s Solitaire
• So named because it is based on manipulations ofplaying cards
◦ Who would question an innocent deck of cards?. . . OK, we’ll ignore that.
• Sender and Receiver begin with matched decks
• Each application of Solitaire generates a sequence ofkeystream values, each in the range [1..26]
• Roughly:◦ Plaintext + keystream = Ciphertext◦ Ciphertext - keystream = Plaintext
SIGCSE 2006 – p.9/21
![Page 17: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/17.jpg)
Keystream Algorithm: Step 1 of 5
Step 1: Exchange ‘A’ Joker with Following Card
SIGCSE 2006 – p.10/21
![Page 18: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/18.jpg)
Keystream Algorithm: Step 2 of 5
Step 2: Exchange ‘B’ Joker with Following Two Cards
SIGCSE 2006 – p.11/21
![Page 19: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/19.jpg)
Keystream Algorithm: Step 3 of 5
Step 3: “Triple Cut”
SIGCSE 2006 – p.12/21
![Page 20: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/20.jpg)
Keystream Algorithm: Step 4 of 5
1 4 3 7 5 8 2 6
SIGCSE 2006 – p.13/21
![Page 21: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/21.jpg)
Keystream Algorithm: Step 4 of 5
1 4 3 7 5 8 2 6
Step 4: Needs More Words Than I Have Space!
SIGCSE 2006 – p.13/21
![Page 22: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/22.jpg)
Keystream Algorithm: Step 5 of 5
2 1 4 3 7 5 8 6
Step 5:
SIGCSE 2006 – p.14/21
![Page 23: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/23.jpg)
Keystream Algorithm: Step 5 of 5
v=2 1 4 3 7 5 8 6
Step 5: 1st Card’s Value
SIGCSE 2006 – p.14/21
![Page 24: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/24.jpg)
Keystream Algorithm: Step 5 of 5
v=2 1 4 3 7 5 8 6
1 2 v+1 4 . . .
Step 5: 1st Card’s Value + 1 ⇒ Index
SIGCSE 2006 – p.14/21
![Page 25: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/25.jpg)
Keystream Algorithm: Step 5 of 5
v=2 1 4 3 7 5 8 6
1 2 v+1 4 . . .
Step 5: 1st Card’s Value + 1 ⇒ Index ⇒ Keystream Value = 4
SIGCSE 2006 – p.14/21
![Page 26: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/26.jpg)
Encryption
Plaintext: N I F T Y⇓ ⇓ ⇓ ⇓ ⇓
Letter Values: 14 9 6 20 25Keystream Sequence: 4 2 4 1 5
Sums: 18 11 10 21 30Wrap: 18 11 10 21 4
⇓ ⇓ ⇓ ⇓ ⇓
Ciphertext: R K J T D
SIGCSE 2006 – p.15/21
![Page 27: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/27.jpg)
Decryption
Ciphertext: R K J T D⇓ ⇓ ⇓ ⇓ ⇓
Letter Values: 18 11 10 21 4Keystream Sequence: 4 2 4 1 5
Differences: 14 9 6 20 -1Wrap: 14 9 6 20 25
⇓ ⇓ ⇓ ⇓ ⇓
Plaintext: N I F T Y
SIGCSE 2006 – p.16/21
![Page 28: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/28.jpg)
Why “Somewhat Simplified”?
• Schneier has links to implementations in ∼ 12languages
SIGCSE 2006 – p.17/21
![Page 29: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/29.jpg)
Why “Somewhat Simplified”?
• Schneier has links to implementations in ∼ 12languages
• My Standard Adjustments:
◦ Steps 1 and 2: No special bottom-of-deck behavior· Have students assume that the deck is circular
SIGCSE 2006 – p.17/21
![Page 30: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/30.jpg)
Why “Somewhat Simplified”?
• Schneier has links to implementations in ∼ 12languages
• My Standard Adjustments:
◦ Steps 1 and 2: No special bottom-of-deck behavior· Have students assume that the deck is circular
◦ Use a different deck; for example:· Half-deck (only two suits)
· Pinochle deck (need to add jokers)
SIGCSE 2006 – p.17/21
![Page 31: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/31.jpg)
Why “Somewhat Simplified”?
• Schneier has links to implementations in ∼ 12languages
• My Standard Adjustments:
◦ Steps 1 and 2: No special bottom-of-deck behavior· Have students assume that the deck is circular
◦ Use a different deck; for example:· Half-deck (only two suits)
· Pinochle deck (need to add jokers)
⇒ Unwise cryptographically . . . but so what?
SIGCSE 2006 – p.17/21
![Page 32: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/32.jpg)
Adoption Issues
• Skill Prerequisites:◦ List Manipulation◦ Char ⇔ ASCII◦ Text File I/O (?)
SIGCSE 2006 – p.18/21
![Page 33: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/33.jpg)
Adoption Issues
• Skill Prerequisites:◦ List Manipulation◦ Char ⇔ ASCII◦ Text File I/O (?)
• Implementation Decisions:◦ Arrays or Linked Lists?◦ Card Representation?◦ Must state be retained?
SIGCSE 2006 – p.18/21
![Page 34: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/34.jpg)
Adoption Issues
• Skill Prerequisites:◦ List Manipulation◦ Char ⇔ ASCII◦ Text File I/O (?)
• Implementation Decisions:◦ Arrays or Linked Lists?◦ Card Representation?◦ Must state be retained?
∴ Applicable to CS0, CS1, CS2, . . .
SIGCSE 2006 – p.18/21
![Page 35: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/35.jpg)
So Why Is This “Nifty”?
• Flexible — Can assign entire system or just parts
• Provides a gentle introduction to cryptosystems
• Encourages distributed testing (message exchange)
• Would be a fun algorithm to animate
SIGCSE 2006 – p.19/21
![Page 36: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/36.jpg)
So Why Is This “Nifty”?
• Flexible — Can assign entire system or just parts
• Provides a gentle introduction to cryptosystems
• Encourages distributed testing (message exchange)
• Would be a fun algorithm to animate
• Just might encourage students to read a novel! ,
SIGCSE 2006 – p.19/21
![Page 37: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/37.jpg)
Image Credits
• Neal Stephenson: Bela Bollobas
• Bruce Schneier: dk.compulenta.ru
• Stephenson book covers: barnesandnoble.com
• Klondike: AisleRot 2.10.0 / Jonathan Blandford
• Cards As Weapons: amazon.com
• Card Images: david.bellot.free.fr
• UA Campus: The UA Computer Science Webcam
SIGCSE 2006 – p.20/21
![Page 38: The Somewhat Simplified Solitaire Algorithmmccann/research/solitaire... · 2006. 3. 8. · The Somewhat Simplified Solitaire Algorithm Lester I. McCann mccann@cs.arizona.edu Computer](https://reader035.vdocuments.net/reader035/viewer/2022062606/5fe38518e9a2be759a120972/html5/thumbnails/38.jpg)
Any Quick Questions?
These full–screen PDF slides were created in LATEX using the prosper class.
SIGCSE 2006 – p.21/21