06.01.2015 Views

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

226 CHAPTER 11. KNAPSACK CIPHERS<br />

trial-and-error.) But it is easy to use the Knapsack System as a polygraphic<br />

cipher.<br />

Examples:<br />

(1) Use the weights {3, 4, 7, 15, 30, 47, 93, 279, 466, 749}, and the values e =<br />

211 and P = 1507 to encipher swim as pairs <strong>of</strong> letters.<br />

First, we compute the U’s:<br />

U 1 = (3 · 211)%1507 = 633<br />

U 2 = (4 · 211)%1507 = 844<br />

U 3 = (7 · 211)%1507 = 1477<br />

U 4 = (15 · 211)%1507 = 151<br />

U 5 = (30 · 211)%1507 = 302<br />

U 6 = (47 · 211)%1507 = 875<br />

U 7 = (93 · 211)%1507 = 32<br />

U 8 = (279 · 211)%1507 = 96<br />

U 9 = (466 · 211)%1507 = 371<br />

U 10 = (749 · 211)%1507 = 1311<br />

Then we encipher as before, just with more weights:<br />

sw = {10011}{10111} = 1001110111<br />

→ 1 · U 1 + 1 · U 4 + 1 · U 5 + 1 · U 6 + 1 · U 8 + 1 · U 9 + 1 · U 10<br />

= 633 + 151 + 302 + 875 + 96 + 371 + 1311<br />

= 3739<br />

Similarly, im becomes 2585.<br />

(2) Decipher 2585.<br />

We first need the deciphering number. From the Euclidean algorithm<br />

d = 50 is the solution to (d × 211)%1507 = 1. Next, 2585 becomes<br />

(d × 2585)%1507 = 1155. Finally, write 1155 as a sum <strong>of</strong> the original<br />

weights:<br />

1155 = 4 + 30 + 93 + 279 + 749<br />

= U 2 + U 5 + U 7 + U 8 + U + 10<br />

= 0100101101 = {01001}{01101}<br />

→ im<br />

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!