Cryptography

القيصر الصغير

This challenge is a Caesar Cipher with a small twist, Handout:

from egypt import محمد_رمضان
def التشفير(النص):
    النص_المشفر = ""
    for حرف in النص:
        النص_المشفر += chr(((حرف) + محمد_رمضان * 5) % 256)
    return النص_المشفر

النص = b"REDACTED"
النص_المشفر = (التشفير(النص))

print(النص_المشفر)

Since we all know that Mohammad Ramadan = 1, our solver should look something like this:

ct = b'Uqf~lwtzsixHYKYm9spd~5zdk5wd~5zwdu9wy6h6u9y65s'
flag = ''
for i in ct:
    flag += chr(i  - 5)
    
print(flag)

# PlaygroundsCTF{Th4nk_y0u_f0r_y0ur_p4rt1c1p4t10n}

NotSoBabyRSA

This is an RSA challenge that tests the competitors knowledge in modular arithmetic and the RSA cipher

We have, e and phi so we can find d easily, but our bottleneck is that we don’t have N. This is what the hint is for, let’s work out the math behind it.

hint=coeff×phi+phintmodphicoeffphi+pmodphi(coeffphi)modphi+pmodphiSince phi > p, p mod phi = p0+pmodphi=p hint = coeff \times phi + p \newline \to hint \mod phi \equiv coeff *phi + p \mod phi \newline \equiv (coeff * phi) \mod phi + p \mod phi \newline \text {Since phi > p, p mod phi = p} \newline \equiv 0 + p \mod phi = p

So we have found p by taking hint % phi, now what we have p we can find q through phi thus finding N and breaking the encryption.

Building Pyramids

Handout:

If we try adding a print line to see what our key tends to look like, and we notice its either 0.xxxx or 1.xxxx so basically in the range of sin(x) + 1 with rounding to the 4th decimal point, this means we have 20,000 possible keys. bruteforcable.

Simple RSA

Classic RSA challenge, encrypting char by char

This challenge is similar to Giza Cipher except you’ll have to generate the table by encrypting all printable characters with the public key and comparing with the given ciphertext list

Calc 101

Let’s look at our source

Usually in these challenges we try to look for ways to make our key predictable, since we can differentiate the polynomial as many times as we want, we can differentiate it so many times it becomes 0, making any random input into the function output a 0 as the encryption key.

Last updated