反复平方法快速取幂
a^b mod n
//伪代码
c=0
d=1
let <bk,bk-1....b0>be the binary representation of b
for i=k downto 0
c=2c
d=(d*d) mod n
if bi ==1
c=c+1
d=(d*a)mod n
return d
反复平方法快速取幂
a^b mod n
//伪代码
c=0
d=1
let <bk,bk-1....b0>be the binary representation of b
for i=k downto 0
c=2c
d=(d*d) mod n
if bi ==1
c=c+1
d=(d*a)mod n
return d