Mod Arithmetic Strangeness
Previous    Next    Home    Source    Diffie-Hellman Key Exchange

   
Notes
  1. Instructions, top: Enter numbers in textfields a:, b:, and m: then hit return. The results in textfields a*b mod m: and (a mod m)*(b mod m) mod m: show that you can first take the mod of two numbers before multiplying them and still get the same result had you multiplied first, then taken the mod of the result. This is really great since we plan to exponentiate huge numbers - now mod exponentiation is merely repeated multiplication of fairly small (moded) numbers.

  2. Instructions, bottom: Enter numbers in textfields a:, b: m:, and base: and hit return. The results in textfields (base^a mod m)^b mod m: and (base^b mod m)^a mod m: show that the order in which mod exponentiation is carried out is irrelevant. This is really great since we plan to use mod exponentiation all over the place.