Primes Part 1

Factoring

Resources:

Current recommendation is 1024 bits prime. Multiplied, it will give us 2048 bits modulus and therefore called RSA-2048. Other than manual factorization, there is a prime factors database for large integers called factordbarrow-up-right.

Here's the PoC for the challenge.

n = 510143758735509025530880200653196460532653147

# from factordb
p = 19704762736204164635843
q = 25889363174021185185929

print(min(p,q))

Flag: 19704762736204164635843

Inferius Prime

We are given the source code:

The code "calculated" that n is 1600 bits long. It assumed that the number inside getPrime() is in bytes, which is wrong. The number is in bits. Therefore, n is only 100 + 100 = 200 bits long, a length that is easily breakable.

Here is the solution for the challenge.

Flag: crypto{N33d_b1g_pR1m35}

Monoprime

For any prime number p, the Euler's totient function is Ο†(p) = p-1.

Here's the PoC for the challenge.

Flag: crypto{0n3_pr1m3_41n7_pr1m3_l0l}

Square Eyes

This time, n is a square of prime p. Remember Euler's totient function formula:

With n = p^2, then phi = p(2-1)*(p-1), which is simplified to phi = p*(p-1).

Here is the solver code for the challenge.

Flag: crypto{squar3_r00t_i5_f4st3r_th4n_f4ct0r1ng!}

Manyprime

This time, n has over 30 prime factors. We can solve this using factordb, but we can also use an optimized factoring method for this scenario (ref: Sage Elliptic Curvearrow-up-right).

Here is a solver to the challenge.

Flag: crypto{700_m4ny_5m4ll_f4c70r5}

Last updated