1 / 11

Week 7

Heuristic Searches Intro to Cryptography Slides courtesy of Professor Sheridan Houghten. Week 7. Generic Heuristic Search – see section 5.1, KS. c = 0; select a feasible solution X; X best = X; while(c <= c max ) // c counts the number of iterations {

astra
Download Presentation

Week 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Heuristic Searches Intro to Cryptography Slides courtesy of Professor Sheridan Houghten Week 7

  2. Generic Heuristic Search – see section 5.1, KS • c = 0; • select a feasible solution X; • Xbest = X; • while(c <= cmax) // c counts the number of iterations • { • Y = hN(X); //using chosen search strategy • if(Y != fail) • { • X = Y; • if(P(X) > P(Xbest)) • Xbest = X; • } • c++; • } • return Xbest;

  3. Uniform Graph Partition (UGP) Example (see section 5.1.1, KS) X0 = 0257, X1 = 1346 Cost: 8 + 7 + 2 + 4 = 21

  4. Uniform Graph Partition – UGP • Algorithm to find initial solution: • SelectPartition() • { • r = random(0, (2n choose n) – 1); • X0 = KSubsetLexUnrank(r, n, 2n); • //note change from book • X1 = V – X0; • }

  5. UGP Neighbourhood Search Ascend([X0, X1]) { g = 0; // gain for each i in X0 { for each j in X1 { t = gain([X0, X1], i, j); if(t > g) // current best { x = i; y = j; g = t; } } } if g > 0 // improved { Y0 = (X0 U {y}) – {x}; Y1 = (X1 U {x}) – {y}; fail = false; return ([Y0, Y1]); } else // no improvement { fail = true; return ([X0, X1]); } }

  6. Hill Climbing for UGP UGP(cmax) { [X0, X1] = SelectPartition(); for(c = 0; c < cmax; c++) { [Y0, Y1] = Ascend([X0, X1]); if(!fail) // use new partition and try again { X0 = Y0; X1 = Y1; } else return; // couldn’t improve } }

  7. Simulated Annealing (UGP) T = T0; Select feasible solution X; Xbest = X; for(c = 0; c < cmax; c++, T *= a) { Y = hN(X); // random feas. soln from neigh. search // UGP: find random values of i and j to swap if(Y != fail) { if(P(Y) >= P(X)) // improved: always keep it { X = Y; if(P(X) > P(Xbest) Xbest = X; } else // not improved: may keep it { r = random(0,1); if(r < exp((P(Y) – P(X))/T) X = Y; } } } return Xbest;

  8. Shift Cipher Example K = 11, Plaintext: “meetatmidnight” Translation: 12 4 4 19 0 19 12 8 3 13 8 6 7 19 Encryption: 23 15 15 4 11 4 23 19 14 24 19 17 18 4 Corresponding ciphertext: “XPPELEXTOYTRSE” Translation: 23 15 15 4 11 4 23 19 14 24 19 17 18 4 Decryption: 12 4 4 19 0 19 12 8 3 13 8 6 7 19 Corresponding plaintext: “meetatmidnight”

  9. Substitution Cipher Example Possible permutation for encryption: Corresponding permutation for decryption: Plaintext: meetatnoon Ciphertext: THHMXMSFFS

  10. Vigenere Cipher Example Keyword: BROCK → key = (1,17,14,2,10) Plaintext: “meetatmidnight” Translation: 12 4 4 19 0 19 12 8 3 13 8 6 7 19 Encryption: 13 21 18 21 10 20 3 22 5 23 9 23 21 21 Corresponding ciphertext: “NVSVKUDWFXJXVV” Translation: 13 21 18 21 10 20 3 22 5 23 9 23 21 21 Decryption: 12 4 4 19 0 19 12 8 3 13 8 6 7 19 Corresponding plaintext: “meetatmidnight”

  11. Stream Cipher ExampleLinear Feedback Register Let m = 4 and zi+4 = (zi + zi+1) mod 2

More Related