Skip to content

Instantly share code, notes, and snippets.

@mendel3
mendel3 / multi_prime_rsa.py
Created July 19, 2021 05:07
Values from LITCTF 2021
# Solves multi prime rsa given n, e, and c. Need to factor n into primes first (recommend yafu)
# Reference https://crypto.stackexchange.com/questions/31109/rsa-enc-decryption-with-multiple-prime-modulus-using-crt
# From https://github.com/diogoaj/ctf-writeups/tree/master/2018/Timisoara/crypto/NotYourAverageRSA
# Params
e = 65537
c = 5995952936037255929781924635247478684210608634033130708312547257115162490907542249878843535087479397093661825467058312432783733583919194527896596274111265902276347768535338414466405501311805051241244
n = 10588750243470683238253385410274703579658358849388292003988652883382013203466393057371661939626562904071765474423122767301289214711332944602077015274586262780328721640431549232327069314664449442016399
# primes are factored from n
primes = [2151055861, 2319991937, 2341310833, 2391906757, 2448497717, 2493514393, 2586983803, 2758321513, 2784469417, 2816940109, 2865965429, 3092165243, 3218701459, 3438516511, 3526137361, 3663803701, 3673658161, 3789550043, 3866428117, 3919632263, 414

Keybase proof

I hereby claim:

  • I am mendel3 on github.
  • I am mendel3 (https://keybase.io/mendel3) on keybase.
  • I have a public key ASCodFZSoCuyWd6JbvB0h67PN-d8hQ07TDLepWvEOBq2Qwo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am mendel3 on github.
* I am mendel3 (https://keybase.io/mendel3) on keybase.
* I have a public key ASB8FOD06SvvaK_zYHznLZrGRGifCJ6OUdi51fPX0LTTfQo
To claim this, I am signing this object: