CRT、Primitive roots、Discrete Logarithms

版权声明:转载请附上文章地址 https://blog.csdn.net/weixin_38134491/article/details/85012705

The Chinese Remainder Theorem

Used to speed up modulo computations!!!

If working modulo a product of numbers: mod M=m1*m2*m3*....*mk

CRT let us work in each moduli mi separately.

To compute A(mod M):

1. First compute all   separately

Problem 1

If x≡5 mod 7,  x≡3 mod 11, x≡10 mod 13, x mod 1001?

Problem 2

x≡2 mod 3 ,  x≡3 mod 5, x≡2 mod 7, 求x

Answer:

a1=2 , m1=3

a2=3, m2=5

a3=2, m3=7 

M=3*5*7=105

M1=m2*m3=35

M2=m3*m1=21

M3=m1*m2=15

Y1=M1^-1 mod m1=35^-1 mod 3=2

Y2=M2^-1 mod m2=21^-1 mod 5=1

Y3=M3^-1 mod m3=15^-1 mod 7=1

x=(Y1M1a1+Y2M2a2+Y3M3a3) mod M

=(140+63+30)

=233 mod 105

=23

Primitive roots

From Euler's theorem have a^Ø(n) =1 mod n

Then what is primitive roots???

Consider a^m =1 mod n, gcd(a,n)=1, must exist for m but may be smaller than Ø(n),

if smallest is m=Ø(n) then a is called a primitive root.

for a prime number 19, primitive roots are 2,3,10,13,14,15

Discrete Logarithms

猜你喜欢

转载自blog.csdn.net/weixin_38134491/article/details/85012705