






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Information on various topics in computational number theory, including the extended euclidean algorithm, modular inverses, lagrange's theorem, euler's theorem, fermat's little theorem, primitives, and generating primitive elements. It includes algorithms and lemmas for finding extended greatest common divisors, modular inverses, and testing primitivity.
Typology: Slides
1 / 11
This page cannot be seen from the preview
Don't miss anything!
2
INPUT: non-negative integers ( x, `y ) not both 0
OUTPUT: integers ( g, s, t ) with g = gcd( x,y )
and s,t satisfying sx + ty = g
(g, s, t) ExtendedGCD(x, y){
if (y == 0) return (x,1,1);
(g, s, t) = ExtendedGCD(y, x mod y);
return (g, t, );
4
DEF: Let g be an element of a finite group G.
The order of g “o( g )” is the smallest positive
number n such that.
Lagrange’s THM: Let N = | G |. The order of any
element is a divisor of N. I.e. for all g , o( g ) | N.
COR1 - Euler’s THM: Let G =. If m is rel.
prime to n , then so
COR2 - Fermat’s little THM: Let G = with
p prime. Then for all m,. If in
addition gcd( m , p )= 1 then_._
n
Z
∗ n
!( n )
Z
∗ p
p
p − 1
5
Let G be a group of cardinality N.
RECALL: g is primitive in G iff o( g ) = N.
Equivalently: all elements are powers of g. G is
called cyclic if it has a primitive element.
TESTING LEMMA: Let be the
prime factors of N = | G |. Then an element g is
primitive iff:
LEMMA: Suppose g is primitive in G. Then is
primitive iff gcd( i, N ) = 1.
Theorem: The multiplicative ring of any finite
field is cyclic. In particular is cyclic.
i
Z
∗ p
N
7
LEMMA: If G is cyclic with cardinality factoring
into then the probability of
success is:
COR 1 : If is cyclic, then the
probability of success is
COR2: If with p = 2 q + 1 and p, q
prime: the probability of success is^1
2
−
1
p − 1
∗ m !(!( m ))
!( m )
∗ p
e 1
e 2
et t !( N ) N
=
t
i = 1
(
1 −
1 pi
)
8
INPUT: Element , exponent e ≥ 0
OUTPUT:
EXTERNAL: Black box for multiplication
FastExponentiation( g, e ){
= Binary( n )
a = g, b = 1
for i = 0 to k {
if , { } // using black-box
// using black-box
}
return b
}
e
10
DEF: A quadratic residue mod p is an
integer with a square root in. Legendre
symbol:
Notation QR ( p ) = {quadratic residues mod p }
LEMMA: For odd p and g primitive.
I.e. is a quadratic residue iff i is even.
Z
∗ p
2
( gi p
) = − 1 i
i
11
Following gives simple Quadratic Residue Test:
LEMMA 1 : Let p be and odd prime. For each
quadratic residue n mod p there are exactly
two square roots of n of the form ± r.
LEMMA2: Suppose also that p mod 4 = 3. If n
is a quadratic residue mod p , then a square
root of n is obtained by the formula
n
p
= n
p − 1 (^2) mod p
p + 1