Challenges
e and φ are not coprime
Cryptography
Medium
gcd(e, phi) = 3
Solves: 6
e and φ are not coprime
Author: CyberSamSU
Points
55
Usually gcd(e, φ) = 1 is required — only then does d = e^(-1) mod φ exist. But in this challenge, the developer mistakenly chose e = 21 and gcd(e, φ) = 3 came out. Now there is no simple d.
In this case, the key owner (who knows the private primes) can still decrypt — that is why p and q are given to you. Solution: we solve e·d + φ·k = 3 with the extended Euclidean algorithm (here 3 = gcd). Then c^d = m^(e·d) = m^3 · (m^φ)^k = m^3 mod n. That is, we recover m^3. Because the flag is short, m^3 < n — a simple integer cube root gives the answer.
p =
8136684082491665215325583220892483304154410090711052838810546597
2099308740259640468455773495554420565262986519858754826312677815
02827856235078803143941833
q =
7100433891048958203630539048554188164185993557317004593149401722
2379375405104765537021216347578828715563895336836140721820878340
64351074443974183182074251
c =
4769338115254543235996193573102928927428622613282166006056244810
4348815720096929388682397553394102693943552620503746155849162044
3779199113738198413357449868510151530895122053870081080585774494
0639530060761443958925001470448547598935256324102361633882576277
3179900932932392232964924350189744998349054536917235
n = p·q, φ = (p−1)(q−1). If gcd(e, φ) = g, in the general case we recover m^g, then the g-th root.
To submit a flag, log in.