NOI 2009 Solutions to Contest Tasks

Size: px
Start display at page:

Download "NOI 2009 Solutions to Contest Tasks"

Transcription

1 NOI 2009 Solutions to Contest Tasks Martin Henz March 14, 2009 Martin Henz NOI 2009 Solutions to Contest Tasks 1

2 The Scientific Committee of NOI 2009 Ben Leong Chang Ee-Chien Colin Tan Frank Stephan Martin Henz Sung Wing Kin Martin Henz NOI 2009 Solutions to Contest Tasks 2

3 1 XMAS Martin Henz NOI 2009 Solutions to Contest Tasks 3

4 Program in Pascal 1 XMAS Program in Pascal Martin Henz NOI 2009 Solutions to Contest Tasks 4

5 XMAS Program in Pascal At a Secret Santa Christmas party, each guest brings a gift and places it under the Christmas tree. Each guest gets exactly one gift from under the tree. Martin Henz NOI 2009 Solutions to Contest Tasks 5

6 XMAS Program in Pascal At a Secret Santa Christmas party, each guest brings a gift and places it under the Christmas tree. Each guest gets exactly one gift from under the tree. You are given a list that says whose gift each person receives, and need to compile a list of guests that pick each person s gift. Martin Henz NOI 2009 Solutions to Contest Tasks 6

7 XMAS Program in Pascal Alice brings an apple, Bob brings a balloon, and Carol brings a cake. Given: Alice gets the balloon, Bob gets the cake, and Carol gets the apple. Required list: Apple goes to Carol, balloon goes to Alice, cake goes to Bob. Martin Henz NOI 2009 Solutions to Contest Tasks 7

8 XMAS Program in Pascal Picking a gift corresponds to a permutation of the list of guests. Martin Henz NOI 2009 Solutions to Contest Tasks 8

9 XMAS Program in Pascal Picking a gift corresponds to a permutation of the list of guests. Task compute the inverse of the permutation. Martin Henz NOI 2009 Solutions to Contest Tasks 9

10 XMAS Program in Pascal Idea For each gift, remember its receiver. Then output the receivers in a loop. Martin Henz NOI 2009 Solutions to Contest Tasks 10

11 Program in Pascal XMAS Program in Pascal program xmas ; var R e c e i v e r : array [ ] of i n t e g e r ; g u e s t s, g i f t s, guest, g i f t : i n t e g e r ; begin readln ( g u e s t s ) ; g i f t s := g u e s t s ; f o r g u e s t := 1 to g u e s t s do begin readln ( g i f t ) ; R e c e i v e r [ g i f t ] := g u e s t ; end ; f o r g i f t := 1 to g i f t s do w r i t e l n ( R e c e i v e r [ g i f t ] ) ; end. Martin Henz NOI 2009 Solutions to Contest Tasks 11

12 Complexity XMAS Program in Pascal There is a fixed amount of work done in each loop body. Martin Henz NOI 2009 Solutions to Contest Tasks 12

13 Complexity XMAS Program in Pascal There is a fixed amount of work done in each loop body. Each loop runs through all guests (gifts). Martin Henz NOI 2009 Solutions to Contest Tasks 13

14 Complexity XMAS Program in Pascal There is a fixed amount of work done in each loop body. Each loop runs through all guests (gifts). Overall: the runtime grows proportional to the number of guests. Martin Henz NOI 2009 Solutions to Contest Tasks 14

15 1 XMAS Martin Henz NOI 2009 Solutions to Contest Tasks 15

16 Investment options: oil, shares, steel, silver and gold. Investor has to commit to an investment plan over m months. Investor has to commit to a sum of $2520 which is invested each month. Each month, the investor has to buy one product for $2520. Investor has to buy the same product in the first 15 months of the plan (or in all months if it is shorter than 15 months). Two consecutive changes of the product bought must be separated by at least 14 months, in which the product remains unchanged. Martin Henz NOI 2009 Solutions to Contest Tasks 16

17 XMAS For a 36 months plan it is possible to buy gold the first 18 months, then silver the next 15 months and then gold again the remaining three months. Martin Henz NOI 2009 Solutions to Contest Tasks 17

18 Input XMAS First six rows contain buy price in given month; last row contains sell price after last month. Martin Henz NOI 2009 Solutions to Contest Tasks 18

19 Desired Output XMAS Best returns: The amount of money that can be earned from selling all investments at the end of the period, after investing each month in the best possible way. Martin Henz NOI 2009 Solutions to Contest Tasks 19

20 A Naive Approach Consider all possible combinations of investments. : G-G-O-O-O-S For each combination, check that it meets the rules. If it meets the rules, compute the returns. Output the highest return. Martin Henz NOI 2009 Solutions to Contest Tasks 20

21 XMAS Complexity! We have to go through 5 months combinations! Martin Henz NOI 2009 Solutions to Contest Tasks 21

22 First Idea XMAS Observation We are allowed to change the investment product only after at least 15 months Martin Henz NOI 2009 Solutions to Contest Tasks 22

23 First Idea XMAS Observation We are allowed to change the investment product only after at least 15 months Reduce combinations Only consider months in which a change of product happens. Martin Henz NOI 2009 Solutions to Contest Tasks 23

24 First Idea XMAS Observation We are allowed to change the investment product only after at least 15 months Reduce combinations Only consider months in which a change of product happens. Complexity reduces to 5 months/15 combinations! Martin Henz NOI 2009 Solutions to Contest Tasks 24

25 Second Idea XMAS Memoization Once we have computed the best return when starting with a certain product on a given month, we don t need to compute it any more; we simply remember the computed value in a table. Martin Henz NOI 2009 Solutions to Contest Tasks 25

26 Second Idea Memoization Once we have computed the best return when starting with a certain product on a given month, we don t need to compute it any more; we simply remember the computed value in a table. Complexity The overall runtime reduces to numberofproducts numberofmonths Martin Henz NOI 2009 Solutions to Contest Tasks 26

27 1 XMAS Martin Henz NOI 2009 Solutions to Contest Tasks 27

28 XMAS The map of a house is given by a grid like this one: B F X X F F X X F S A lazy cat at a S tarting point wants to pick up all F ood items and then go to B ed. Martin Henz NOI 2009 Solutions to Contest Tasks 28

29 Rules B F X X F F X X F S Only step left, right, up or down Do not step on walls marked with X Martin Henz NOI 2009 Solutions to Contest Tasks 29

30 Traveling Salesman (TSP) The problem Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. Martin Henz NOI 2009 Solutions to Contest Tasks 30

31 Traveling Salesman (TSP) The problem Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. Martin Henz NOI 2009 Solutions to Contest Tasks 31

32 Traveling Salesman (TSP) The problem Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. Optimal tour visiting Germany s 15 largest cities Martin Henz NOI 2009 Solutions to Contest Tasks 32

33 Traveling Salesman (TSP) The problem Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. Optimal tour visiting Germany s 15 largest cities Shortest among 43,589,145,600 possible tours Martin Henz NOI 2009 Solutions to Contest Tasks 33

34 Traveling Salesman (TSP) The problem Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. Optimal tour visiting Germany s 15 largest cities Shortest among 43,589,145,600 possible tours There is no known algorithm that can solve this problem efficiently Martin Henz NOI 2009 Solutions to Contest Tasks 34

35 Traveling Salesman (TSP) The problem Given a list of cities and their pairwise distances, the task is to find a shortest possible tour that visits each city exactly once. Optimal tour visiting Germany s 15 largest cities Shortest among 43,589,145,600 possible tours There is no known algorithm that can solve this problem efficiently Runtime of best algorithm grows exponentially with number of cities Martin Henz NOI 2009 Solutions to Contest Tasks 35

36 TSP With A Twist XMAS B F X X F F X X F S Martin Henz NOI 2009 Solutions to Contest Tasks 36

37 TSP With A Twist XMAS B F X X F F X X F S What is the distance between F ood items? We need to compute the shortest path between two food items, considering the walls marked with X Martin Henz NOI 2009 Solutions to Contest Tasks 37

38 Overall Strategy XMAS Compute the distances between each pair of food items and between S and B and the food items using a shortest path algorithm Martin Henz NOI 2009 Solutions to Contest Tasks 38

39 Overall Strategy Compute the distances between each pair of food items and between S and B and the food items using a shortest path algorithm Try all possible combinations starting with S, going through all F, and ending in S and compute the travel distance Martin Henz NOI 2009 Solutions to Contest Tasks 39

40 Overall Strategy Compute the distances between each pair of food items and between S and B and the food items using a shortest path algorithm Try all possible combinations starting with S, going through all F, and ending in S and compute the travel distance Remember the shortest distance obtained so far, and at the end, output that number Martin Henz NOI 2009 Solutions to Contest Tasks 40

41 : Cryptography Some History Breaking a Symmetric Key Cipher Alice sends a message m to Bob. The message may be intercepted by Eve along the way. Martin Henz NOI 2009 Solutions to Contest Tasks 41

42 : Cryptography Some History Breaking a Symmetric Key Cipher Alice sends a message m to Bob. The message may be intercepted by Eve along the way. Solution Alice encrypts m using a key k that is only known to Bob. Martin Henz NOI 2009 Solutions to Contest Tasks 42

43 Some History Breaking a Symmetric Key Cipher : Cryptography Alice sends a message m to Bob. The message may be intercepted by Eve along the way. Solution Alice encrypts m using a key k that is only known to Bob. Symmetric key cipher c = E(m, k) m = D(c, k) Martin Henz NOI 2009 Solutions to Contest Tasks 43

44 Some History Breaking a Symmetric Key Cipher Engima Cryptography in WW-I and WW-II German encryption machine The most common encryption technique in WW-II employed by the German military was based on an encryption machine called Enigma. Martin Henz NOI 2009 Solutions to Contest Tasks 44

45 Some History Breaking a Symmetric Key Cipher Breaking Enigma Weaknesses Enigma had cryptographic weaknesses, but ultimately the following factors led to the breaking of codes: procedural flaws, operator mistakes, occasional captured machines and key tables Martin Henz NOI 2009 Solutions to Contest Tasks 45

46 Some History Breaking a Symmetric Key Cipher Breaking Enigma Weaknesses Enigma had cryptographic weaknesses, but ultimately the following factors led to the breaking of codes: procedural flaws, operator mistakes, occasional captured machines and key tables Guessing messages Keine besonderen Vorkommnisse (in English: No particular events ) Martin Henz NOI 2009 Solutions to Contest Tasks 46

47 Some History Breaking a Symmetric Key Cipher Alan Turing Turing s role in breaking German ciphers Alan Turing worked at Bletchley Park, Britain s codebreaking centre. Martin Henz NOI 2009 Solutions to Contest Tasks 47

48 Some History Breaking a Symmetric Key Cipher Alan Turing Turing s role in breaking German ciphers Alan Turing worked at Bletchley Park, Britain s codebreaking centre. Bombe Turing devised a number of techniques for breaking German ciphers, including the method of the bombe, an electromechanical machine that could find settings for the Enigma machine. Martin Henz NOI 2009 Solutions to Contest Tasks 48

49 Some History Breaking a Symmetric Key Cipher Alan Turing Turing s role in breaking German ciphers Alan Turing worked at Bletchley Park, Britain s codebreaking centre. Bombe Turing devised a number of techniques for breaking German ciphers, including the method of the bombe, an electromechanical machine that could find settings for the Enigma machine. Father of computer science Turing provided an influential formalisation of the concept of the algorithm and computation with the Turing machine. Martin Henz NOI 2009 Solutions to Contest Tasks 49

50 Some History Breaking a Symmetric Key Cipher Breaking a Symmetric Key Cipher Symmetric key cipher c = E(m, k) m = D(c, k) Martin Henz NOI 2009 Solutions to Contest Tasks 50

51 Some History Breaking a Symmetric Key Cipher Breaking a Symmetric Key Cipher Symmetric key cipher c = E(m, k) m = D(c, k) Attacker stituation Eve gets hold of c, m, E and D, and wants to find k. Martin Henz NOI 2009 Solutions to Contest Tasks 51

52 Some History Breaking a Symmetric Key Cipher Breaking a Symmetric Key Cipher Symmetric key cipher c = E(m, k) m = D(c, k) Attacker stituation Eve gets hold of c, m, E and D, and wants to find k. Strategy Try all possible keys k i and test: c = E(m, k i )? Martin Henz NOI 2009 Solutions to Contest Tasks 52

53 Some History Breaking a Symmetric Key Cipher Double Encoding Idea c = E(E(m, k 1 ), k 2 ) m = D(D(c, k 2 ), k 1 ) Martin Henz NOI 2009 Solutions to Contest Tasks 53

54 Some History Breaking a Symmetric Key Cipher Double Encoding Idea c = E(E(m, k 1 ), k 2 ) m = D(D(c, k 2 ), k 1 ) Attacker stituation Eve gets hold of c, m, E and D, and wants to find k 1 and k 2. Martin Henz NOI 2009 Solutions to Contest Tasks 54

55 Some History Breaking a Symmetric Key Cipher Double Encoding Idea c = E(E(m, k 1 ), k 2 ) m = D(D(c, k 2 ), k 1 ) Attacker stituation Eve gets hold of c, m, E and D, and wants to find k 1 and k 2. Naive strategy Try all possible keys k1 i and kj 2, an compute: c = E(E(m, k1 i ), kj 2 ) Martin Henz NOI 2009 Solutions to Contest Tasks 55

56 Better Approach XMAS Some History Breaking a Symmetric Key Cipher Idea Work forward and backward, and check if results match Martin Henz NOI 2009 Solutions to Contest Tasks 56

57 Better Approach XMAS Some History Breaking a Symmetric Key Cipher Idea Work forward and backward, and check if results match Implementation Try all possible keys k1 i x = E(m, k1 i ) and x = D(c, k2 i ) and compute: Martin Henz NOI 2009 Solutions to Contest Tasks 57

58 Better Approach XMAS Some History Breaking a Symmetric Key Cipher Idea Work forward and backward, and check if results match Implementation Try all possible keys k1 i x = E(m, k1 i ) and x = D(c, k2 i ) and compute: Hash table Use a hash table to remember all x values, and for each x value, look in the hash table for a match. Martin Henz NOI 2009 Solutions to Contest Tasks 58

Cristina Nita-Rotaru. CS355: Cryptography. Lecture 4: Enigma.

Cristina Nita-Rotaru. CS355: Cryptography. Lecture 4: Enigma. CS355: Cryptography Lecture 4: Enigma. Towards cryptographic engines } How to move from pencil and paper to more automatic ways of encrypting and decrypting? } How to design more secure ciphers } Alberti

More information

Cryptography A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. Apr Cryptography Slide 1

Cryptography A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. Apr Cryptography Slide 1 Cryptography A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering Apr. 2007 Cryptography Slide 1 About This Presentation This presentation belongs to the lecture series

More information

Algebra for Cryptology

Algebra for Cryptology Algebra for Cryptology Arkadii Slinko Department of Mathematics The University of Auckland Auckland, 6 April, 2013 What is cryptology? Cryptology is about communication in the presence of adversaries or

More information

Cryptography A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. Apr Cryptography Slide 1

Cryptography A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. Apr Cryptography Slide 1 Cryptography A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering Apr. 2016 Cryptography Slide 1 About This Presentation This presentation belongs to the lecture series

More information

Attacks on RSA & Using Asymmetric Crypto

Attacks on RSA & Using Asymmetric Crypto Attacks on RSA & Using Asymmetric Crypto Luke Anderson luke@lukeanderson.com.au 7 th April 2017 University Of Sydney Overview 1. Crypto-Bulletin 2. Breaking RSA 2.1 Chinese Remainder Theorem 2.2 Common

More information

CS/COE

CS/COE CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ P vs NP But first, something completely different... Some computational problems are unsolvable No algorithm can be written that will always produce the correct

More information

Number Theory in Cryptography

Number Theory in Cryptography Number Theory in Cryptography Introduction September 20, 2006 Universidad de los Andes 1 Guessing Numbers 2 Guessing Numbers (person x) (last 6 digits of phone number of x) 3 Guessing Numbers (person x)

More information

The Hill Cipher A Linear Algebra Perspective

The Hill Cipher A Linear Algebra Perspective The Hill Cipher A Linear Algebra Perspective Contents 1 Introduction to Classical Cryptography 3 1.1 Alice, Bob & Eve................................. 3 1.2 Types of Attacks.................................

More information

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2 Contents 1 Recommended Reading 1 2 Public Key/Private Key Cryptography 1 2.1 Overview............................................. 1 2.2 RSA Algorithm.......................................... 2 3 A Number

More information

Can a Machine Think?

Can a Machine Think? Can a Machine Think? Mathematics 15: Lecture 27 Dan Sloughter Furman University December 4, 2006 Dan Sloughter (Furman University) Can a Machine Think? December 4, 2006 1 / 8 Alan Turing 1912-1954 Dan

More information

Cryptography. P. Danziger. Transmit...Bob...

Cryptography. P. Danziger. Transmit...Bob... 10.4 Cryptography P. Danziger 1 Cipher Schemes A cryptographic scheme is an example of a code. The special requirement is that the encoded message be difficult to retrieve without some special piece of

More information

Facts & Myths of Enigma

Facts & Myths of Enigma Facts & Myths of Enigma Breaking Stereotypes Arkadiusz Orłowski & Kris Gaj How should we begin? Begin at the beginning, and go on till you come to the end: then stop. The King to the White Rabbit Lewis

More information

RSA RSA public key cryptosystem

RSA RSA public key cryptosystem RSA 1 RSA As we have seen, the security of most cipher systems rests on the users keeping secret a special key, for anyone possessing the key can encrypt and/or decrypt the messages sent between them.

More information

CS 282A/MATH 209A: Foundations of Cryptography Prof. Rafail Ostrosky. Lecture 4

CS 282A/MATH 209A: Foundations of Cryptography Prof. Rafail Ostrosky. Lecture 4 CS 282A/MATH 209A: Foundations of Cryptography Prof. Rafail Ostrosky Lecture 4 Lecture date: January 26, 2005 Scribe: Paul Ray, Mike Welch, Fernando Pereira 1 Private Key Encryption Consider a game between

More information

Cryptography: A Fairy Tale for Mathematicians and Starring Mathematicians!

Cryptography: A Fairy Tale for Mathematicians and Starring Mathematicians! Cryptography: A Fairy Tale for Mathematicians and Starring Mathematicians! University of California, Berkeley Mathematics Undergraduate Student Association October 27, 2014 Why Crypto? So why on earth

More information

6.080/6.089 GITCS April 8, Lecture 15

6.080/6.089 GITCS April 8, Lecture 15 6.080/6.089 GITCS April 8, 2008 Lecturer: Scott Aaronson Lecture 15 Scribe: Tiffany Wang 1 Administrivia Midterms have been graded and the class average was 67. Grades will be normalized so that the average

More information

Lecture 1: Introduction to Public key cryptography

Lecture 1: Introduction to Public key cryptography Lecture 1: Introduction to Public key cryptography Thomas Johansson T. Johansson (Lund University) 1 / 44 Key distribution Symmetric key cryptography: Alice and Bob share a common secret key. Some means

More information

Number theory (Chapter 4)

Number theory (Chapter 4) EECS 203 Spring 2016 Lecture 12 Page 1 of 8 Number theory (Chapter 4) Review Compute 6 11 mod 13 in an efficient way What is the prime factorization of 100? 138? What is gcd(100, 138)? What is lcm(100,138)?

More information

last name ID 1 c/cmaker/cbreaker 2012 exam version a 6 pages 3 hours 40 marks no electronic devices SHOW ALL WORK

last name ID 1 c/cmaker/cbreaker 2012 exam version a 6 pages 3 hours 40 marks no electronic devices SHOW ALL WORK last name ID 1 c/cmaker/cbreaker 2012 exam version a 6 pages 3 hours 40 marks no electronic devices SHOW ALL WORK 8 a b c d e f g h i j k l m n o p q r s t u v w x y z 1 b c d e f g h i j k l m n o p q

More information

Cryptography. pieces from work by Gordon Royle

Cryptography. pieces from work by Gordon Royle Cryptography pieces from work by Gordon Royle The set-up Cryptography is the mathematics of devising secure communication systems, whereas cryptanalysis is the mathematics of breaking such systems. We

More information

QUANTUM CRYPTOGRAPHY. BCS, Plymouth University, December 1, Professor Kurt Langfeld Centre for Mathematical Sciences, Plymouth University

QUANTUM CRYPTOGRAPHY. BCS, Plymouth University, December 1, Professor Kurt Langfeld Centre for Mathematical Sciences, Plymouth University QUANTUM CRYPTOGRAPHY BCS, Plymouth University, December 1, 2015 Professor Kurt Langfeld Centre for Mathematical Sciences, Plymouth University OUTLOOK: Quantum Physics Essentials: particles and light are

More information

1 Indistinguishability for multiple encryptions

1 Indistinguishability for multiple encryptions CSCI 5440: Cryptography Lecture 3 The Chinese University of Hong Kong 26 September 2012 1 Indistinguishability for multiple encryptions We now have a reasonable encryption scheme, which we proved is message

More information

9 Knapsack Cryptography

9 Knapsack Cryptography 9 Knapsack Cryptography In the past four weeks, we ve discussed public-key encryption systems that depend on various problems that we believe to be hard: prime factorization, the discrete logarithm, and

More information

What is the computational cost of automating brilliance or serendipity? (P vs NP question and related musings) COS 116: 4/12/2006 Adam Finkelstein

What is the computational cost of automating brilliance or serendipity? (P vs NP question and related musings) COS 116: 4/12/2006 Adam Finkelstein What is the computational cost of automating brilliance or serendipity? (P vs NP question and related musings) COS 116: 4/12/2006 Adam Finkelstein Combination lock Why is it secure? (Assume it cannot be

More information

L7. Diffie-Hellman (Key Exchange) Protocol. Rocky K. C. Chang, 5 March 2015

L7. Diffie-Hellman (Key Exchange) Protocol. Rocky K. C. Chang, 5 March 2015 L7. Diffie-Hellman (Key Exchange) Protocol Rocky K. C. Chang, 5 March 2015 1 Outline The basic foundation: multiplicative group modulo prime The basic Diffie-Hellman (DH) protocol The discrete logarithm

More information

Hamiltonian Cycle. Zero Knowledge Proof

Hamiltonian Cycle. Zero Knowledge Proof Hamiltonian Cycle Zero Knowledge Proof Hamiltonian cycle Hamiltonian cycle - A path that visits each vertex exactly once, and ends at the same point it started Example Hamiltonian cycle - A path that visits

More information

Introduction to Cryptography. Lecture 8

Introduction to Cryptography. Lecture 8 Introduction to Cryptography Lecture 8 Benny Pinkas page 1 1 Groups we will use Multiplication modulo a prime number p (G, ) = ({1,2,,p-1}, ) E.g., Z 7* = ( {1,2,3,4,5,6}, ) Z p * Z N * Multiplication

More information

Specialized Cryptanalytic Machines: Two examples, 60 years apart. Patrick Schaumont ECE Department Virginia Tech

Specialized Cryptanalytic Machines: Two examples, 60 years apart. Patrick Schaumont ECE Department Virginia Tech Specialized Cryptanalytic Machines: Two examples, 60 years apart Patrick Schaumont ECE Department Virginia Tech What is cryptanalysis? Cryptography aims to defeat cryptanalysis Cryptanalysis aims to defeat

More information

Clock Arithmetic and Euclid s Algorithm

Clock Arithmetic and Euclid s Algorithm Clock Arithmetic and Euclid s Algorithm Lecture notes for Access 2008 by Erin Chamberlain. Earlier we discussed Caesar Shifts and other substitution ciphers, and we saw how easy it was to break these ciphers

More information

CRYPTOGRAPHY AND LARGE PRIMES *

CRYPTOGRAPHY AND LARGE PRIMES * CRYPTOGRAPHY AND LARGE PRIMES * B. Hartley University of Manchester, England, and National University of Singapore The word "cryptography" derives from Greek and means "secret writing". Since ancient times,

More information

Data Structures in Java

Data Structures in Java Data Structures in Java Lecture 21: Introduction to NP-Completeness 12/9/2015 Daniel Bauer Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways

More information

19 Lorenz Cipher Machine

19 Lorenz Cipher Machine 9 Lorenz Cipher Machine During the Second World War, the codebreakers at Bletchley Park devised a variety of techniques that enabled the Allies to break the major codes used by the Germans. Not only was

More information

Topics in Complexity

Topics in Complexity Topics in Complexity Please evaluate this course on Axess! Your feedback really does make a difference. Applied Complexity Theory Complexity theory has enormous practical relevance across various domains

More information

Cryptography and Number Theory

Cryptography and Number Theory Chapter 2 Cryptography and Number Theory 2.1 Cryptography and Modular Arithmetic 2.1.1 Introduction to Cryptography For thousands of years people have searched for ways to send messages in secret. For

More information

Mathematics: Modeling Our World Unit 2: SECRET CODES SUPPLEMENTAL ACTIVITY THE GOLD BUG S2.1

Mathematics: Modeling Our World Unit 2: SECRET CODES SUPPLEMENTAL ACTIVITY THE GOLD BUG S2.1 Mathematics: Modeling Our World Unit 2: SECRET CODES SUPPLEMENTAL ACTIVITY THE GOLD BUG S2.1 In The Gold Bug by Edgar Allan Poe, the character William Legrand stumbles across what appears to be a coded

More information

3.6.1 Building Functions from Context. Warm Up

3.6.1 Building Functions from Context. Warm Up Name: # Honors Coordinate Algebra: Period Ms. Pierre Date: 3.6.1 Building Functions from Context Warm Up 1. Willem buys 4 mangoes each week, and mango prices vary from week to week. Write an equation that

More information

CSA E0 235: Cryptography March 16, (Extra) Lecture 3

CSA E0 235: Cryptography March 16, (Extra) Lecture 3 CSA E0 235: Cryptography March 16, 2015 Instructor: Arpita Patra (Extra) Lecture 3 Submitted by: Ajith S 1 Chosen Plaintext Attack A chosen-plaintext attack (CPA) is an attack model for cryptanalysis which

More information

Ciphers: Making and Breaking

Ciphers: Making and Breaking Ciphers: Making and Breaking Ralph Morelli Trinity College, Hartford (ralph.morelli@trincoll.edu) Smithsonian Institute October 31, 2009 2009 Ralph Morelli You are free to reuse and remix this presentation

More information

Introduction to Cryptographic Engineering. Steven M. Bellovin

Introduction to Cryptographic Engineering. Steven M. Bellovin Introduction to Cryptographic Engineering Steven M. Bellovin https://www.cs.columbia.edu/~smb 1 Cryptographic Engineering? There are lots of introductions to encryption But using encryption in the real

More information

CHALMERS GÖTEBORGS UNIVERSITET. TDA352 (Chalmers) - DIT250 (GU) 11 April 2017, 8:30-12:30

CHALMERS GÖTEBORGS UNIVERSITET. TDA352 (Chalmers) - DIT250 (GU) 11 April 2017, 8:30-12:30 CHALMERS GÖTEBORGS UNIVERSITET CRYPTOGRAPHY TDA35 (Chalmers) - DIT50 (GU) 11 April 017, 8:30-1:30 No extra material is allowed during the exam except for pens and a simple calculator (not smartphones).

More information

On the Legacy of Quantum Computation and Communication to Cryptography

On the Legacy of Quantum Computation and Communication to Cryptography On the Legacy of Quantum Computation and Communication to Cryptography 1 X. Li, L. Leung, A. Kwan, X. Zhang, D. Kahanda, K. Tang, and M. Anshel Department of Computer Science, Graduate Center of The City

More information

Tractable & Intractable Problems

Tractable & Intractable Problems Tractable & Intractable Problems We will be looking at : What is a P and NP problem NP-Completeness The question of whether P=NP The Traveling Salesman problem again Programming and Data Structures 1 Polynomial

More information

Systems of Equations and Inequalities

Systems of Equations and Inequalities 7 Systems of Equations and Inequalities CHAPTER OUTLINE Introduction Figure 1 Enigma machines like this one, once owned by Italian dictator Benito Mussolini, were used by government and military officials

More information

Lecture 38: Secure Multi-party Computation MPC

Lecture 38: Secure Multi-party Computation MPC Lecture 38: Secure Multi-party Computation Problem Statement I Suppose Alice has private input x, and Bob has private input y Alice and Bob are interested in computing z = f (x, y) such that each party

More information

What is the computational cost of automating brilliance or serendipity? (Computational complexity & P vs NP) COS 116, Spring 2010 Adam Finkelstein

What is the computational cost of automating brilliance or serendipity? (Computational complexity & P vs NP) COS 116, Spring 2010 Adam Finkelstein What is the computational cost of automating brilliance or serendipity? (Computational complexity & P vs NP) COS 116, Spring 2010 Adam Finkelstein Combination lock Why is it secure? (Assume it cannot be

More information

Quantum Entanglement and Cryptography. Deepthi Gopal, Caltech

Quantum Entanglement and Cryptography. Deepthi Gopal, Caltech + Quantum Entanglement and Cryptography Deepthi Gopal, Caltech + Cryptography Concisely: to make information unreadable by anyone other than the intended recipient. The sender of a message scrambles/encrypts

More information

Historical cryptography. cryptography encryption main applications: military and diplomacy

Historical cryptography. cryptography encryption main applications: military and diplomacy Historical cryptography cryptography encryption main applications: military and diplomacy ancient times world war II Historical cryptography All historical cryptosystems badly broken! No clear understanding

More information

Notes 10: Public-key cryptography

Notes 10: Public-key cryptography MTH6115 Cryptography Notes 10: Public-key cryptography In this section we look at two other schemes that have been proposed for publickey ciphers. The first is interesting because it was the earliest such

More information

CRYPTOGRAPHY AND NUMBER THEORY

CRYPTOGRAPHY AND NUMBER THEORY CRYPTOGRAPHY AND NUMBER THEORY XINYU SHI Abstract. In this paper, we will discuss a few examples of cryptographic systems, categorized into two different types: symmetric and asymmetric cryptography. We

More information

Introduction to Elliptic Curve Cryptography. Anupam Datta

Introduction to Elliptic Curve Cryptography. Anupam Datta Introduction to Elliptic Curve Cryptography Anupam Datta 18-733 Elliptic Curve Cryptography Public Key Cryptosystem Duality between Elliptic Curve Cryptography and Discrete Log Based Cryptography Groups

More information

Grade 6 Math Circles October 20/21, Formalism and Languages: Beyond Regular Languages

Grade 6 Math Circles October 20/21, Formalism and Languages: Beyond Regular Languages Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 6 Math Circles October 20/21, 2015 Formalism and Languages: Beyond Regular Languages Dr. Troy Vasiga

More information

Cryptography. Lecture 2: Perfect Secrecy and its Limitations. Gil Segev

Cryptography. Lecture 2: Perfect Secrecy and its Limitations. Gil Segev Cryptography Lecture 2: Perfect Secrecy and its Limitations Gil Segev Last Week Symmetric-key encryption (KeyGen, Enc, Dec) Historical ciphers that are completely broken The basic principles of modern

More information

Solutions for week 1, Cryptography Course - TDA 352/DIT 250

Solutions for week 1, Cryptography Course - TDA 352/DIT 250 Solutions for week, Cryptography Course - TDA 352/DIT 250 In this weekly exercise sheet: you will use some historical ciphers, the OTP, the definition of semantic security and some combinatorial problems.

More information

Systems of Equations and Inequalities

Systems of Equations and Inequalities 7 Systems of Equations and Inequalities CHAPTER OUTLINE Introduction Figure 1 Enigma machines like this one, once owned by Italian dictator Benito Mussolini, were used by government and military officials

More information

Cryptography and RSA. Group (1854, Cayley) Upcoming Interview? Outline. Commutative or Abelian Groups

Cryptography and RSA. Group (1854, Cayley) Upcoming Interview? Outline. Commutative or Abelian Groups Great Theoretical Ideas in CS V. Adamchik CS 15-251 Upcoming Interview? Lecture 24 Carnegie Mellon University Cryptography and RSA How the World's Smartest Company Selects the Most Creative Thinkers Groups

More information

Network Security Technology Spring, 2018 Tutorial 3, Week 4 (March 23) Due Date: March 30

Network Security Technology Spring, 2018 Tutorial 3, Week 4 (March 23) Due Date: March 30 Network Security Technology Spring, 2018 Tutorial 3, Week 4 (March 23) LIU Zhen Due Date: March 30 Questions: 1. RSA (20 Points) Assume that we use RSA with the prime numbers p = 17 and q = 23. (a) Calculate

More information

Logic gates. Quantum logic gates. α β 0 1 X = 1 0. Quantum NOT gate (X gate) Classical NOT gate NOT A. Matrix form representation

Logic gates. Quantum logic gates. α β 0 1 X = 1 0. Quantum NOT gate (X gate) Classical NOT gate NOT A. Matrix form representation Quantum logic gates Logic gates Classical NOT gate Quantum NOT gate (X gate) A NOT A α 0 + β 1 X α 1 + β 0 A N O T A 0 1 1 0 Matrix form representation 0 1 X = 1 0 The only non-trivial single bit gate

More information

Private Key Cryptography. Fermat s Little Theorem. One Time Pads. Public Key Cryptography

Private Key Cryptography. Fermat s Little Theorem. One Time Pads. Public Key Cryptography Fermat s Little Theorem Private Key Cryptography Theorem 11 (Fermat s Little Theorem): (a) If p prime and gcd(p, a) = 1, then a p 1 1 (mod p). (b) For all a Z, a p a (mod p). Proof. Let A = {1, 2,...,

More information

8 Elliptic Curve Cryptography

8 Elliptic Curve Cryptography 8 Elliptic Curve Cryptography 8.1 Elliptic Curves over a Finite Field For the purposes of cryptography, we want to consider an elliptic curve defined over a finite field F p = Z/pZ for p a prime. Given

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 3 January 22, 2013 CPSC 467b, Lecture 3 1/35 Perfect secrecy Caesar cipher Loss of perfection Classical ciphers One-time pad Affine

More information

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 20 Travelling Salesman Problem

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 20 Travelling Salesman Problem Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur Lecture - 20 Travelling Salesman Problem Today we are going to discuss the travelling salesman problem.

More information

Chapter 2 Classical Cryptosystems

Chapter 2 Classical Cryptosystems Chapter 2 Classical Cryptosystems Note We will use the convention that plaintext will be lowercase and ciphertext will be in all capitals. 2.1 Shift Ciphers The idea of the Caesar cipher: To encrypt, shift

More information

quantum distribution of a sudoku key Sian K. Jones University of South Wales

quantum distribution of a sudoku key Sian K. Jones University of South Wales Games and Puzzles quantum distribution of a sudoku key Sian K. Jones University of South Wales sian-kathryn.jones@southwales.ac.uk Abstract: Sudoku grids are often cited as being useful in cryptography

More information

1999 version 2001 simplified version

1999 version 2001 simplified version 香港中文大學讀書會 1999 version 2001 simplified version Author Simon Singh http://simonsingh.net/ 1. Fermat s Last Theorem the epic quest to Solve the World's Greatest Mathematical Problem(2007) 2. The Code Book(1999)

More information

Question 1. The Chinese University of Hong Kong, Spring 2018

Question 1. The Chinese University of Hong Kong, Spring 2018 CSCI 5440: Cryptography The Chinese University of Hong Kong, Spring 2018 Homework 2 Solutions Question 1 Consider the following encryption algorithm based on the shortlwe assumption. The secret key is

More information

An Introduction to Cryptography

An Introduction to Cryptography An Introduction to Cryptography Spotlight on Science J. Robert Buchanan Department of Mathematics Spring 2008 What is Cryptography? cryptography: study of methods for sending messages in a form that only

More information

In fact, 3 2. It is not known whether 3 1. All three problems seem hard, although Shor showed that one can solve 3 quickly on a quantum computer.

In fact, 3 2. It is not known whether 3 1. All three problems seem hard, although Shor showed that one can solve 3 quickly on a quantum computer. Attacks on RSA, some using LLL Recall RSA: N = pq hard to factor. Choose e with gcd(e,φ(n)) = 1, where φ(n) = (p 1)(q 1). Via extended Euclid, find d with ed 1 (mod φ(n)). Discard p and q. Public key is

More information

SAT, Coloring, Hamiltonian Cycle, TSP

SAT, Coloring, Hamiltonian Cycle, TSP 1 SAT, Coloring, Hamiltonian Cycle, TSP Slides by Carl Kingsford Apr. 28, 2014 Sects. 8.2, 8.7, 8.5 2 Boolean Formulas Boolean Formulas: Variables: x 1, x 2, x 3 (can be either true or false) Terms: t

More information

CIS 6930/4930 Computer and Network Security. Topic 5.2 Public Key Cryptography

CIS 6930/4930 Computer and Network Security. Topic 5.2 Public Key Cryptography CIS 6930/4930 Computer and Network Security Topic 5.2 Public Key Cryptography 1 Diffie-Hellman Key Exchange 2 Diffie-Hellman Protocol For negotiating a shared secret key using only public communication

More information

Elliptic curves: Theory and Applications. Day 4: The discrete logarithm problem.

Elliptic curves: Theory and Applications. Day 4: The discrete logarithm problem. Elliptic curves: Theory and Applications. Day 4: The discrete logarithm problem. Elisa Lorenzo García Université de Rennes 1 14-09-2017 Elisa Lorenzo García (Rennes 1) Elliptic Curves 4 14-09-2017 1 /

More information

COS433/Math 473: Cryptography. Mark Zhandry Princeton University Spring 2017

COS433/Math 473: Cryptography. Mark Zhandry Princeton University Spring 2017 COS433/Math 473: Cryptography Mark Zhandry Princeton University Spring 2017 Previously on COS 433 Pre- modern Cryptography 1900 B.C. mid 1900 s A.D With few exceptions, synonymous with encryption c = Enc(k,m)

More information

Linear Equations and Inequalities

Linear Equations and Inequalities Unit 2 Linear Equations and Inequalities 9/26/2016 10/21/2016 Name: By the end of this unit, you will be able to Use rate of change to solve problems Find the slope of a line Model real-world data with

More information

Chapter 7: Systems of Linear Equations

Chapter 7: Systems of Linear Equations Chapter 7: Systems of Linear Equations Section 7.1 Chapter 7: Systems of Linear Equations Section 7.1: Developing Systems of Linear Equations Terminology: System of Linear Equations: A grouping of two

More information

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia www.cs.virginia.edu/~njb2b/theory

More information

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 18 November 3, 2014 CPSC 467, Lecture 18 1/43 Zero Knowledge Interactive Proofs (ZKIP) Secret cave protocol ZKIP for graph isomorphism

More information

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Module No. # 01 Lecture No. # 33 The Diffie-Hellman Problem

More information

Practice Assignment 2 Discussion 24/02/ /02/2018

Practice Assignment 2 Discussion 24/02/ /02/2018 German University in Cairo Faculty of MET (CSEN 1001 Computer and Network Security Course) Dr. Amr El Mougy 1 RSA 1.1 RSA Encryption Practice Assignment 2 Discussion 24/02/2018-29/02/2018 Perform encryption

More information

Class 24: Computability

Class 24: Computability Menu Class 24: Review: Gödel s Theorem Proof in Axiomatic Systems : Are there some problems that it is impossible to write a program to solve? Halting Problems Hockey Team Logo CS150: Computer Science

More information

ENEE 457: Computer Systems Security 09/19/16. Lecture 6 Message Authentication Codes and Hash Functions

ENEE 457: Computer Systems Security 09/19/16. Lecture 6 Message Authentication Codes and Hash Functions ENEE 457: Computer Systems Security 09/19/16 Lecture 6 Message Authentication Codes and Hash Functions Charalampos (Babis) Papamanthou Department of Electrical and Computer Engineering University of Maryland,

More information

Security Implications of Quantum Technologies

Security Implications of Quantum Technologies Security Implications of Quantum Technologies Jim Alves-Foss Center for Secure and Dependable Software Department of Computer Science University of Idaho Moscow, ID 83844-1010 email: jimaf@cs.uidaho.edu

More information

Analysis of Algorithms. Unit 5 - Intractable Problems

Analysis of Algorithms. Unit 5 - Intractable Problems Analysis of Algorithms Unit 5 - Intractable Problems 1 Intractable Problems Tractable Problems vs. Intractable Problems Polynomial Problems NP Problems NP Complete and NP Hard Problems 2 In this unit we

More information

Lecture 5: Pseudorandom functions from pseudorandom generators

Lecture 5: Pseudorandom functions from pseudorandom generators Lecture 5: Pseudorandom functions from pseudorandom generators Boaz Barak We have seen that PRF s (pseudorandom functions) are extremely useful, and we ll see some more applications of them later on. But

More information

Algorithms and Data Structures Final Lesson

Algorithms and Data Structures Final Lesson Algorithms and Data Structures Final Lesson Michael Schwarzkopf https://www.uni weimar.de/de/medien/professuren/medieninformatik/grafische datenverarbeitung Bauhaus University Weimar July 11, 2018 (Corrected

More information

Public Key Cryptography

Public Key Cryptography Public Key Cryptography Spotlight on Science J. Robert Buchanan Department of Mathematics 2011 What is Cryptography? cryptography: study of methods for sending messages in a form that only be understood

More information

2016 King s College Math Competition. Instructions

2016 King s College Math Competition. Instructions 06 King s College Math Competition King s College welcomes you to this year s mathematics competition and to our campus. We wish you success in this competition and in your future studies. Instructions

More information

17.1 Binary Codes Normal numbers we use are in base 10, which are called decimal numbers. Each digit can be 10 possible numbers: 0, 1, 2, 9.

17.1 Binary Codes Normal numbers we use are in base 10, which are called decimal numbers. Each digit can be 10 possible numbers: 0, 1, 2, 9. ( c ) E p s t e i n, C a r t e r, B o l l i n g e r, A u r i s p a C h a p t e r 17: I n f o r m a t i o n S c i e n c e P a g e 1 CHAPTER 17: Information Science 17.1 Binary Codes Normal numbers we use

More information

Chapter 2. A Look Back. 2.1 Substitution ciphers

Chapter 2. A Look Back. 2.1 Substitution ciphers Chapter 2 A Look Back In this chapter we take a quick look at some classical encryption techniques, illustrating their weakness and using these examples to initiate questions about how to define privacy.

More information

Lecture 11: Hash Functions, Merkle-Damgaard, Random Oracle

Lecture 11: Hash Functions, Merkle-Damgaard, Random Oracle CS 7880 Graduate Cryptography October 20, 2015 Lecture 11: Hash Functions, Merkle-Damgaard, Random Oracle Lecturer: Daniel Wichs Scribe: Tanay Mehta 1 Topics Covered Review Collision-Resistant Hash Functions

More information

Exam Security January 19, :30 11:30

Exam Security January 19, :30 11:30 Exam Security January 19, 2016. 8:30 11:30 You can score a maximum of 100. Each question indicates how many it is worth. You are NOT allowed to use books or notes, or a (smart) phone. You may answer in

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security Outline Authentication CPSC 467b: Cryptography and Computer Security Lecture 18 Michael J. Fischer Department of Computer Science Yale University March 29, 2010 Michael J. Fischer CPSC 467b, Lecture 18

More information

P, NP, NP-Complete. Ruth Anderson

P, NP, NP-Complete. Ruth Anderson P, NP, NP-Complete Ruth Anderson A Few Problems: Euler Circuits Hamiltonian Circuits Intractability: P and NP NP-Complete What now? Today s Agenda 2 Try it! Which of these can you draw (trace all edges)

More information

CSE 105 Theory of Computation

CSE 105 Theory of Computation CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s Agenda Quick Review of CFG s and PDA s Introduction to Turing Machines and their Languages Reminders and

More information

2016 King s College Math Competition. Instructions

2016 King s College Math Competition. Instructions 06 King s College Math Competition King s College welcomes you to this year s mathematics competition and to our campus. We wish you success in this competition and in your future studies. Instructions

More information

Public-Key Cryptosystems CHAPTER 4

Public-Key Cryptosystems CHAPTER 4 Public-Key Cryptosystems CHAPTER 4 Introduction How to distribute the cryptographic keys? Naïve Solution Naïve Solution Give every user P i a separate random key K ij to communicate with every P j. Disadvantage:

More information

(Updated February 17, 2006) Laszlo B. Kish.

(Updated February 17, 2006) Laszlo B. Kish. Response to Bollinger's "On the Impossibility of Keeping Out Eavesdroppers Using Only Classical Physics" and to Some Other Comments at Bruce Schneier's Blog Sites (Updated February 17, 2006) Laszlo B.

More information

Winter 2008 Introduction to Modern Cryptography Benny Chor and Rani Hod. Assignment #2

Winter 2008 Introduction to Modern Cryptography Benny Chor and Rani Hod. Assignment #2 0368.3049.01 Winter 2008 Introduction to Modern Cryptography Benny Chor and Rani Hod Assignment #2 Published Sunday, February 17, 2008 and very slightly revised Feb. 18. Due Tues., March 4, in Rani Hod

More information

Unit 5 Test Review Systems of Linear Equations Name Class Date

Unit 5 Test Review Systems of Linear Equations Name Class Date Unit 5 Test Review Systems of Linear Equations Name Class Date Find the mistake - The following problems have been solved HOWEVER there could be a mistake. Each question is worth 3 points: 1pt the mistake,

More information

CS3233 Competitive i Programming

CS3233 Competitive i Programming This course material is now made available for public usage. Special acknowledgement to School of Computing, National University of Singapore for allowing Steven to prepare and distribute these teaching

More information

Chapter 2 : Perfectly-Secret Encryption

Chapter 2 : Perfectly-Secret Encryption COMP547 Claude Crépeau INTRODUCTION TO MODERN CRYPTOGRAPHY _ Second Edition _ Jonathan Katz Yehuda Lindell Chapter 2 : Perfectly-Secret Encryption 1 2.1 Definitions and Basic Properties We refer to probability

More information

Lecture th January 2009 Fall 2008 Scribes: D. Widder, E. Widder Today s lecture topics

Lecture th January 2009 Fall 2008 Scribes: D. Widder, E. Widder Today s lecture topics 0368.4162: Introduction to Cryptography Ran Canetti Lecture 11 12th January 2009 Fall 2008 Scribes: D. Widder, E. Widder Today s lecture topics Introduction to cryptographic protocols Commitments 1 Cryptographic

More information