当前位置:网站首页>Mathematical basis of information security Chapter 4 -- quadratic residual and square root
Mathematical basis of information security Chapter 4 -- quadratic residual and square root
2022-06-11 17:28:00 【L3H_ CoLin】
Definition 4.1 set up m As a positive integer , If the congruence x 2 ≡ a ( m o d m ) , ( a , m ) = 1 x^2\equiv a(\mod m),(a,m)=1 x2≡a(modm),(a,m)=1, Have solution , be a It's called a model m Quadratic residue of , Otherwise it is called a module m Quadratic non residual
Definition 4.2 Legendre symbol : ( a p ) (\frac{a}{p}) (pa), When a For the mould p The second remaining time of , The value is 1; Not 2 Time remaining value is -1, if p ∣ a p|a p∣a Then the value is 0
Theorem 4.1 p As a prime number , if a ≡ b ( m o d p ) a\equiv b(\mod p) a≡b(modp), be ( a p ) = ( b p ) (\frac{a}{p})=(\frac{b}{p}) (pa)=(pb)
Congruence x 2 ≡ a ( m o d p ) x^2\equiv a(\mod p) x2≡a(modp) The solution of can be seen as in a finite field Z p \mathbb Z_p Zp Find the polynomial in x 2 − a x^2-a x2−a The root of the .
Theorem 4.2 Euler's criterion :p Is an odd prime number , For any integer a, ( a p ) ≡ a p − 1 2 ( m o d p ) (\frac{a}{p})\equiv a^{\frac{p-1}{2}}(\mod p) (pa)≡a2p−1(modp)
prove :
set up g g g yes Z p \mathbb Z_p Zp The original elements of , be Z p ∗ = { g 0 , g 1 , . . . , g p − 2 } \mathbb Z_p^*=\{g^0,g^1,...,g^{p-2}\} Zp∗={ g0,g1,...,gp−2}
For all 0 ≤ i ≤ p − 1 2 0\le i\le \frac{p-1}{2} 0≤i≤2p−1, ( g 2 i ) p − 1 2 = ( g p − 1 ) i = 1 , ( g 2 i + 1 ) p − 1 2 = ( g p − 1 ) i g p − 1 2 , g p − 1 2 = − 1 (g^{2i})^{\frac{p-1}{2}}=(g^{p-1})^i=1,(g^{2i+1})^{\frac{p-1}{2}}=(g^{p-1})^ig^{\frac{p-1}{2}},g^{\frac{p-1}{2}}=-1 (g2i)2p−1=(gp−1)i=1,(g2i+1)2p−1=(gp−1)ig2p−1,g2p−1=−1( from g We know from the original g p − 1 2 ≠ 1 g^{\frac{p-1}{2}}\ne 1 g2p−1=1, but ( g p − 1 2 ) 2 = 1 (g^{\frac{p-1}{2}})^2= 1 (g2p−1)2=1, So it can only be -1), so ( g p − 1 2 ) 2 i + 1 = − 1 (g^{\frac{p-1}{2}})^{2i+1}=-1 (g2p−1)2i+1=−1
Due to the consideration of module p The quadratic congruence of , therefore a You can view it as Z p \mathbb Z_p Zp The element equivalent to its congruence in
When a ≡ g 2 i ( m o d p ) , 0 ≤ i < p − 1 2 a\equiv g^{2i}(\mod p),0\le i<\frac{p-1}{2} a≡g2i(modp),0≤i<2p−1, polynomial x 2 − a = x 2 − g 2 i x^2-a=x^2-g^{2i} x2−a=x2−g2i Rooted ±gi, so ( a p ) = 1 ≡ a p − 1 2 ( m o d p ) (\frac{a}{p})=1\equiv a^{\frac{p-1}{2}}(\mod p) (pa)=1≡a2p−1(modp)
When a ≡ g 2 i + 1 ( m o d p ) , 0 ≤ i < p − 1 2 a\equiv g^{2i+1}(\mod p),0\le i<\frac{p-1}{2} a≡g2i+1(modp),0≤i<2p−1, polynomial x 2 − a = x 2 − g 2 i + 1 x^2-a=x^2-g^{2i+1} x2−a=x2−g2i+1 There must be no root . Otherwise, if x 0 2 = g 2 i + 1 x_0^2=g^{2i+1} x02=g2i+1, that 1 = ( x 0 2 ) p − 1 2 = ( g 2 i + 1 ) p − 1 2 = − 1 1=(x_0^2)^{\frac{p-1}{2}}=(g^{2i+1})^{\frac{p-1}{2}}=-1 1=(x02)2p−1=(g2i+1)2p−1=−1 contradiction . so ( a p ) = − 1 ≡ a p − 1 2 ( m o d p ) (\frac{a}{p})=-1\equiv a^{\frac{p-1}{2}}(\mod p) (pa)=−1≡a2p−1(modp)
According to the above Theorem , model p The quadratic remainder of is p − 1 2 \frac{p-1}{2} 2p−1 individual ( All even powers of primitive )
inference set up p Is an odd prime number , be
( 1 p ) = 1 (\frac{1}{p})=1 (p1)=1
( − 1 p ) = ( − 1 ) p − 1 2 (\frac{-1}{p})=(-1)^\frac{p-1}{2} (p−1)=(−1)2p−1
( a b p ) = ( a p ) ( b p ) (\frac{ab}{p})=(\frac{a}{p})(\frac{b}{p}) (pab)=(pa)(pb)
( a n p ) = ( a p ) n , n > 0 (\frac{a^n}{p})=(\frac{a}{p})^n,n>0 (pan)=(pa)n,n>0
Theorem 4.3 set up p Is an odd prime number , be ( 2 p ) = ( − 1 ) p 2 − 1 8 (\frac{2}{p})=(-1)^{\frac{p^2-1}{8}} (p2)=(−1)8p2−1
prove : Proof of construction
( p − 1 ) ! ≡ 1 ⋅ 3 ⋅ 5 ⋅ . . . ⋅ ( p − 2 ) ⋅ 2 ⋅ 4 ⋅ . . . ⋅ ( p − 1 ) (p-1)!\equiv 1\cdot 3\cdot 5\cdot ... \cdot (p-2)\cdot 2\cdot 4\cdot ... \cdot (p-1) (p−1)!≡1⋅3⋅5⋅...⋅(p−2)⋅2⋅4⋅...⋅(p−1)
about 4k+1 Type p Yes
≡ 1 ⋅ ( p − 2 ) ⋅ 3 ⋅ ( p − 4 ) ⋅ 5 ⋅ . . . ⋅ p − 3 2 ⋅ ( p − p − 1 2 ) ⋅ 2 p − 1 2 ⋅ ( p − 1 2 ! ) ( m o d p ) \equiv 1\cdot (p-2)\cdot 3\cdot (p-4)\cdot 5\cdot ...\cdot \frac{p-3}{2}\cdot (p-\frac{p-1}{2})\cdot 2^{\frac{p-1}{2}}\cdot (\frac{p-1}{2}!)(\mod p) ≡1⋅(p−2)⋅3⋅(p−4)⋅5⋅...⋅2p−3⋅(p−2p−1)⋅22p−1⋅(2p−1!)(modp)( All the even numbers in the last half are mentioned 2 come out , The first half can be alternately mentioned -1)
≡ ( − 1 ) p − 1 4 ⋅ 2 p − 1 2 ⋅ ( p − 1 2 ! ) 2 ( m o d p ) \equiv (-1)^{\frac{p-1}{4}}\cdot 2^{\frac{p-1}{2}}\cdot(\frac{p-1}{2}!)^2(\mod p) ≡(−1)4p−1⋅22p−1⋅(2p−1!)2(modp)
about 4k+3 Type p Yes
≡ 1 ⋅ ( p − 2 ) ⋅ 3 ⋅ ( p − 4 ) ⋅ 5 ⋅ . . . ⋅ ( p − p − 3 2 ) ⋅ p − 1 2 ⋅ 2 p − 1 2 ⋅ ( p − 1 2 ! ) ( m o d p ) \equiv 1\cdot (p-2)\cdot 3\cdot (p-4)\cdot 5\cdot ...\cdot(p-\frac{p-3}{2})\cdot\frac{p-1}{2}\cdot 2^{\frac{p-1}{2}}\cdot (\frac{p-1}{2}!)(\mod p) ≡1⋅(p−2)⋅3⋅(p−4)⋅5⋅...⋅(p−2p−3)⋅2p−1⋅22p−1⋅(2p−1!)(modp)
≡ ( − 1 ) p − 3 4 ⋅ 2 p − 1 2 ⋅ ( p − 1 2 ! ) 2 ( m o d p ) \equiv (-1)^{\frac{p-3}{4}}\cdot 2^{\frac{p-1}{2}}\cdot(\frac{p-1}{2}!)^2(\mod p) ≡(−1)4p−3⋅22p−1⋅(2p−1!)2(modp)
Wilson Theorem know ( p − 1 ) ! ≡ − 1 ( m o d p ) (p-1)!\equiv -1(\mod p) (p−1)!≡−1(modp), And ( p − 1 2 ! ) 2 ≡ ( − 1 ) p + 1 2 ( m o d p ) (\frac{p-1}{2}!)^2\equiv(-1)^{\frac{p+1}{2}}(\mod p) (2p−1!)2≡(−1)2p+1(modp)( Turn into ( − 1 ) p − 1 2 ( p − 1 ) ! (-1)^{\frac{p-1}{2}}(p-1)! (−1)2p−1(p−1)!) Know when p ≡ ± 1 ( m o d 8 ) p\equiv ±1(\mod 8) p≡±1(mod8) when , 2 p − 1 2 ≡ 1 ( m o d p ) 2^{\frac{p-1}{2}}\equiv 1(\mod p) 22p−1≡1(modp), When p ≡ ± 3 ( m o d 8 ) p\equiv ±3(\mod 8) p≡±3(mod8) when , 2 p − 1 2 ≡ − 1 ( m o d p ) 2^{\frac{p-1}{2}}\equiv -1(\mod p) 22p−1≡−1(modp), Comprehensive verification shows that 2 p − 1 2 ≡ ( − 1 ) p 2 − 1 8 ( m o d p ) 2^{\frac{p-1}{2}}\equiv(-1)^{\frac{p^2-1}{8}}(\mod p) 22p−1≡(−1)8p2−1(modp), According to Euler's rule ( 2 p ) = ( − 1 ) p 2 − 1 8 (\frac{2}{p})=(-1)^{\frac{p^2-1}{8}} (p2)=(−1)8p2−1
Theorem 4.4 The law of quadratic reciprocity :p,q Is a mutually prime odd prime number , be ( q p ) = ( − 1 ) p − 1 2 q − 1 2 ( p q ) (\frac{q}{p})=(-1)^{\frac{p-1}{2}\frac{q-1}{2}}(\frac{p}{q}) (pq)=(−1)2p−12q−1(qp)
prove : It's too complicated , No need to master
Definition 4.3 Jacobi symbols : m = ∏ i = 1 n p i , p i m=\prod_{i=1}^np_i,p_i m=∏i=1npi,pi It's an odd prime , For any integer a Definition a model m The Jacobian symbol of is ( a m ) = ∏ i = 1 n ( a p i ) (\frac{a}{m})=\prod_{i=1}^n(\frac{a}{p_i}) (ma)=∏i=1n(pia),m When it is an odd prime number , Its Jacobian symbol is Legendre symbol .
Theorem 4.5 set up m Positive odd number , a ≡ b ( m o d m ) ⇒ ( a m ) = ( b m ) a\equiv b(\mod m)\Rightarrow (\frac{a}{m})=(\frac{b}{m}) a≡b(modm)⇒(ma)=(mb)
Theorem 4.6 set up m Positive odd number , be
(1) ( 1 m ) = 1 (\frac{1}{m})=1 (m1)=1
(2) ( a b m ) = ( a m ) ( b m ) (\frac{ab}{ m})=(\frac{a}{m})(\frac{b}{m}) (mab)=(ma)(mb)
(3) ( a n m ) = ( a m ) n (\frac{a^n}{m})=(\frac{a}{m})^n (man)=(ma)n
(4) ( − 1 m ) = ( − 1 ) m − 1 2 (\frac{-1}{m})=(-1)^{\frac{m-1}{2}} (m−1)=(−1)2m−1
(5) ( 2 m ) = ( − 1 ) m 2 − 1 8 (\frac{2}{m})=(-1)^{\frac{m^2-1}{8}} (m2)=(−1)8m2−1
Theorem 4.7 set up m,n Positive odd number , be ( n m ) = ( − 1 ) m − 1 2 n − 1 2 ( m n ) (\frac{n}{m})=(-1)^{\frac{m-1}{2}\frac{n-1}{2}}(\frac{m}{n}) (mn)=(−1)2m−12n−1(nm)
Definition 4.4 Quadratic residual problem : Unknown n In the case of the decomposition of , Generally judge an integer a Whether it is a module n The quadratic residue of is a difficult problem , It is called quadratic residual problem .
encryption algorithm 1——Rabin encryption algorithm
Alice Select two 4k+3 Prime of type ( be called Blum prime number )p,q, Calculation n=pq, take p,q Public as private key n.
encryption : Plaintext is an integer m, Ciphertext c=m2(mod n)
Decrypt : Solve the congruence equation c=x2(mod n) You can get 4 A solution , Choose the meaningful solution as the plaintext m.
computing method ——a=x2(mod p),p=4k+3 Solution method
If the above formula has a solution , It's in [0,p-1] There must be a solution , Therefore, when the number is not large, it can be used to a Keep adding p Until you find a perfect square ( This method is right p nothing 4k+3 The limitation of , however p It is inconvenient when it is very big )
from ( a p ) = 1 (\frac{a}{p})=1 (pa)=1 According to Euler's rule a p − 1 2 ≡ 1 ( m o d p ) a^{\frac{p-1}{2}}\equiv 1(\mod p) a2p−1≡1(modp), There are ( a p − 1 4 ) 2 ≡ a ( m o d p ) (a^{\frac{p-1}{4}})^2\equiv a(\mod p) (a4p−1)2≡a(modp), Therefore, the solution is x ≡ ± a p − 1 4 ( m o d p ) x\equiv ±a^{\frac{p-1}{4}}(\mod p) x≡±a4p−1(modp)
encryption algorithm 2——Goldwasser-Micali encryption algorithm
Alice Choose two different prime numbers p,q, And integer y Satisfy ( y p ) = ( y q ) = − 1 (\frac{y}{p})=(\frac{y}{q})=-1 (py)=(qy)=−1. Calculation n=pq,p and q The seat private key is public n,y
encryption : Convert binary integers m As clear text , The first i The place is marked as bi, For everyone , Random selection 0<xi<n, If the bit is 0 Calculation ci=xi2(mod n), Otherwise, calculate ci=yxi2(mod n), Ciphertext for all c
Decrypt : if ci For the mould n Quadratic residue of , Then judge bi=0, otherwise bi=1
Definition 4.5 set up <g> Is an element that consists of g The generated one n Metacyclic group , Then for any a∈<g>, There is 0≤i<n,a=gi, call i For g Bottom a Indicators of , Write it down as indga. The problem of finding indicators , In cryptography, it is usually called discrete logarithm problem .n It is a difficult problem to solve the discrete logarithm problem when the integer is large enough .
Theorem 4.8 set up <g> It's a n Metacyclic group ,a∈<g>, If for a positive integer m Yes :
(1) am=e
(2) For any prime factor p|m, a m p ≠ e a^{\frac{m}{p}}\ne e apm=e, be ord(a)=m, And m|n
Definition 4.8 Primordial root : set up m As a positive integer , Integers a Satisfy (a,m)=1,a model m The order of ordm(a) Refer to a(mod m) stay Z m ∗ \mathbb Z_m^* Zm∗ Order in ; If Z m ∗ \mathbb Z_m^* Zm∗ Is a cyclic group , Integers a It's called a model m The primordial root of means a(mod m) by Z m ∗ \mathbb Z_m^* Zm∗ The generator of
According to the above definition ,a In the mold m Modulo of all integers in the remaining classes m All orders are ordm(a)
According to the original root definition : When m=2,4 when , model m The original roots are 1,3
In a general way , If and only if m=2,4,pa,2pa(p Is an odd prime number ,a≥1), model m It has roots
Theorem 4.9 set up <g> It's a n Metacyclic group ,a,b∈<g>, be indgab ≡ \equiv ≡indga+indgb(mod n)
prove :indga=x,indgb=y, be gx+y=ab= g i n d g a b g^{ind_gab} gindgab
namely g x + y − i n d g a b = e g^{x+y-ind_gab}=e gx+y−indgab=e, also ord(g)=n, so n|x+y-indgab, Therefore, the conclusion is tenable
Definition 4.9 set up m It is greater than 1 The positive integer , If n Second congruence xn=a(mod m), (a,m)=1 Have solution , be a It is called a module m Of n The second surplus , Otherwise, it is a module m Of n Secondary non residual .
Theorem 4.14 ( High order residue ) set up m For more than 1 The positive integer ,g For the mould m One of the original roots ,(a,m)=1,d=(n, φ \varphi φ(m)), that xn=a(mod m) The necessary and sufficient condition for a solution is a φ ( m ) d ≡ 1 ( m o d m ) a^{\frac{\varphi(m)}{d}}\equiv 1(\mod m) adφ(m)≡1(modm)
prove :g For the mould m One of the original roots , therefore Z m ∗ = < g > , x n ≡ a ( m o d m ) \mathbb Z_m^*=<g>,x^n\equiv a(\mod m) Zm∗=<g>,xn≡a(modm) The necessary and sufficient condition for a solution is i n d g x n = i n d g a ⇒ n i n d g x ≡ i n d g a ( m o d φ ( m ) ) ind_gx^n=ind_ga\Rightarrow nind_gx\equiv ind_ga(\mod \varphi(m)) indgxn=indga⇒nindgx≡indga(modφ(m))( Pay attention to the mold m The cyclic group of is only φ ( m ) \varphi(m) φ(m) Elements , Therefore, it is necessary to mold φ ( m ) \varphi(m) φ(m)!), Make X=indgx, Then there are n X ≡ i n d g a ( m o d φ ( m ) ) nX\equiv ind_ga(\mod \varphi(m)) nX≡indga(modφ(m))
The necessary and sufficient condition for the first congruence to have a solution is (n,φ(m))|indga, namely d|indga, Equivalent to indga ≡ \equiv ≡ 0(mod d)
From theorem 2.4(4) Yes φ ( m ) d i n d g a ≡ 0 ( m o d φ ( m ) ) \frac{\varphi(m)}{d}ind_ga\equiv 0(\mod \varphi(m)) dφ(m)indga≡0(modφ(m)). Take... On both sides “ Index ” have to a φ ( m ) d ≡ 1 ( m o d m ) a^{\frac{\varphi(m)}{d}}\equiv 1(\mod m) adφ(m)≡1(modm), So the original proposition holds .
notes : The theorem can also help to solve the number of solutions of high-order congruence . For congruence a x ≡ b ( m o d m ) ax\equiv b(\mod m) ax≡b(modm), The necessary and sufficient condition for its solution is ( a , m ) ∣ b (a,m)|b (a,m)∣b, And the general solution can be written as x = x 0 + m ( a , m ) t , t = 0 , 1 , . . . , ( a , m ) − 1 x=x_0+\frac{m}{(a,m)}t,t=0,1,...,(a,m)-1 x=x0+(a,m)mt,t=0,1,...,(a,m)−1 In the form of , So the number of solutions is ( a , m ) (a,m) (a,m). that n X ≡ i n d g a ( m o d φ ( m ) ) nX\equiv ind_ga(\mod \varphi(m)) nX≡indga(modφ(m)) The solution of should have ( n , φ ( m ) ) (n,\varphi(m)) (n,φ(m)) individual
边栏推荐
- What subclasses inherit, polymorphism, and upward transformation
- 【Mysql】redo log,undo log 和binlog详解(四)
- Talk about the interview questions of the collection
- [online problem] timeout waiting for connection from pool
- Go get downloaded package path
- 合并两个有序链表---2022/02/24
- 05_特征工程—降维
- R语言 mice包 Error in terms.formula(tmp, simplify = TRUE) : ExtractVars里的模型公式不对
- Guide to Dama data management knowledge system: percentage of chapter scores
- GUI guess number game, directly open play
猜你喜欢

Activity | authing's first channel cooperation activity came to a successful conclusion

Service学习笔记02-实战 startService 与bindService

Authing biweekly news: online application market (5.10-5.22)

Leetcode force deduction question

DFS and BFS notes (I) breadth first search based on C language

Biden ordered to enforce the zero trust structure

Semaphore PV operation of process interaction and its code implementation

Learning C language from scratch day 039

Chapter II relational database

How does Sister Feng change to ice?
随机推荐
小白在同花顺上直接办理账户是安全的吗?
Semaphore PV operation of process interaction and its code implementation
Chip mass production, oppo entering a new era?
Leetcode-- array
LeetCode-859. Intimate string
TiDB-unsafe recover(tikv宕机数大于等于一半副本数)
sql server中移除key lookup书签查找
论文阅读 dyngraph2vec: Capturing Network Dynamics using Dynamic Graph Representation Learning
Don't you understand the design and principle of thread pool? Break it up and crush it. I'll teach you how to design the thread pool
为什么udp流设置1316字节
说说集合的面试题
Arraylist集合、对象数组
Docker installs mysql5.7 (enable binlog function and modify characters)
LeetCode-859. 亲密字符串
threejs利用indexeddb缓存加载glb模型
Authing 双周动态:Authing 论坛上线(4.25-5.8)
合并两个有序链表---2022/02/24
Go path: goroot & gopath
Activity | authing's first channel cooperation activity came to a successful conclusion
信息安全数学基础 Chapter 1——整除