Recently, I coded to realized RSA algorithm, I was confused by MOD-POWER problem, I couldn't why the equation is true, I can't give the proof of this equation:
'a^b % m = (...((a % m) * a) % m) ......* a) % m'
from mathematical view?
Recently, I coded to realized RSA algorithm, I was confused by MOD-POWER problem, I couldn't why the equation is true, I can't give the proof of this equation:
'a^b % m = (...((a % m) * a) % m) ......* a) % m'
from mathematical view?
From the basic things we know about multiplication in modular arithmetic.
We know that (a * b) % m == ((a % m) * (b % m)) % m
As the power is defined recursively as
a^0 = 1, a^b = a^(b-1) * a
you prove the modular formula also per induction, i.e., using
a^b % m = ( ( a^(b-1) % m ) * ( a % m ) ) % m
as step.