Starter
Modular Exponentation
Modular exponentation: m^e mod n
In Python: pow(m, e, n)
For the challenge, we can calculate this in Python.
The result is 19906
.
Flag: 19906
Public Keys
To solve the challenge, calculate this.
Flag: 301
Euler's Totient
Euler's totient function of n
(denoted as φ(n)
) counts the number of positive integers less than or equal to n
that are coprime (relatively prime) to n
. Given a prime p
, φ(p)
is calculated as φ(p) = p-1
. For a composite N
made up of factors f1, f2, ..., fi
, the function is calculated as φ(N) = (f1-1)*(f2-1)*...*(fi-1)
.
In the case of RSA, typically, the public modulus N
is a product of two large primes p
and q
. To obtain the decryption key, φ(N)
(or sometimes denoted as phi
) is needed.
To solve the challenge, we can run this code.
Flag: 882564595536224140639625987657529300394956519977044270821168
Private Keys
In RSA, the private key d
is the modular multiplicative inverse of the exponent e
modulo phi
. We can calculate it in Python using d = pow(e, -1, phi)
.
Here's the solver code for the challenge.
Flag: 121832886702415731577073962957377780195510499965398469843281
RSA Decryption
Here's the sript to solve the challenge.
Flag: 13371337
RSA Signatures
Basically, to prove that it is me who send the message, I can encrypt the hash of my message with my private key (not public key). This way, the receiving party can verify the signature by decrypting it with my public key.
In real cryptosystems, it's best practice to use separate keys for encrypting and signing messages.
For the challenge, we need to sign the message crypto{Immut4ble_m3ssag1ng}
using the SHA256
hash function.
Here's the solver.
Flag: 13480738404590090803339831649238454376183189744970683129909766078877706583282422686710545217275797376709672358894231550335007974983458408620258478729775647818876610072903021235573923300070103666940534047644900475773318682585772698155617451477448441198150710420818995347235921111812068656782998168064960965451719491072569057636701190429760047193261886092862024118487826452766513533860734724124228305158914225250488399673645732882077575252662461860972889771112594906884441454355959482925283992539925713424132009768721389828848907099772040836383856524605008942907083490383109757406940540866978237471686296661685839083475
Last updated