Download presentation

Presentation is loading. Please wait.

Published byKale Wheelhouse Modified about 1 year ago

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

2
2 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 { Y = h N (X); //using chosen search strategy if(Y != fail) { X = Y; if(P(X) > P(X best )) X best = X; } c++; } return X best ;

3
3 Uniform Graph Partition (UGP) Example (see section 5.1.1, KS) uv[Y0,Y1]GainCost , , , , , , X 0 = 0257, X 1 = 1346 Cost: = 21

4
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
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
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
7 Simulated Annealing (UGP) T = T0; Select feasible solution X; X best = X; for(c = 0; c < cmax; c++, T *= a) { Y = h N (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(X best ) X best = X; } else // not improved: may keep it { r = random(0,1); if(r < exp((P(Y) – P(X))/T) X = Y; } return X best ;

8
8 Shift Cipher Example K = 11, Plaintext:“meetatmidnight” Translation: Encryption: Corresponding ciphertext: “XPPELEXTOYTRSE” Translation: Decryption: Corresponding plaintext: “meetatmidnight”

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

10
10 Vigenere Cipher Example Keyword: BROCK → key = (1,17,14,2,10) Plaintext:“meetatmidnight” Translation: Encryption: Corresponding ciphertext: “NVSVKUDWFXJXVV” Translation: Decryption: Corresponding plaintext: “meetatmidnight”

11
11 Stream Cipher Example Linear Feedback Register Let m = 4 and z i+4 = (z i + z i+1 ) mod 2

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google