20-CS-5153 Network Security Spring 2017
Z*n

Secret Key, Public Key, Hash Algorithms, IPSec, Kerberos, Authentication, more

 

Instructions: Select a number from the menu, call it n. The set of all numbers that are prime relative to n appears in a row that is labeled Z*n. Click on a button in the Z*n row. Call the number displayed on that button m. The number m will be multiplied by all numbers in the set Z*n, modulo n. The results appear directly below each element of Z*n in the row labeled res:. For example, if n is 19 and 9 is clicked, 9*9 mod 19 is 5 which is directly below the 9; if 5 is clicked, 5*14 mod 19 is 13 which appears below the 14 in the Z*n row.

Observe:

  1. All of the numbers in the Z*n row are unique and they all appear uniquely in the res: row.
  2. Every number in Z*n must have an inverse since 1 must always appear in both rows as implied by the above. For example, if n is 19, the inverse of 9 is found by clicking on the 9 and locating the 1 in the res: row. The number directly above the 1 is 17. Hence, 17 is the inverse of 9 mod 19.
  3. The number in the button below the clicked button is the square of the number in the clicked button. Hence the square root of a number, if it exists, may be obtained by clicking buttons until the desired number appears in the res: row beneath the clicked button. The number above that one is its square root.
  4. If n is prime, half the numbers of Z*n have two square roots, the others have no square roots.
  5. The two square roots of a number that has square roots are at the same offset from either end of the top row. Hence, for n = 19, the square root of 1 is 1 and 18, the square root of 4 is 2 and 17, the square root of 9 is 3 and 16 and so on.
  6. n-1 mod n is also -1 mod n. Hence, if n is prime, each square root is -1 times the other.

Below: Select a number from the menu, call it n. The set of all numbers that are prime relative to n appears in a row that is labeled Z*n. Select one of the numbers, call it a. Compute an-1 by clicking on the Multiply button until the count n-1 is reached. The answer in the result field should be 1.

Observe:

  1. If n is prime there is a number in Z*n, called a generator and denoted g, such that gi, 1≤i<n, is unique, and an element of Z*n and gn-1 is 1. For a generator the result: field will not display 1 until the count is n-1. A generator for n = 19 is 10.

Below: Select a number from the menu, call it n. The set of all numbers that are prime relative to n appears in a row that is labeled Z*n. Compute the product of all numbers in Z*n by clicking the Multiply button repeatedly until no more changes take place.

Observe:

  1. If n is prime, the number in the result: textfield is n-1 when finished.