The encrypted text we got given was
Some fiddling around with the capitalisation of the base64 characters got us the actually-printable string
which decoded to yield the flag.
flag{does_this_even_count_as_cryptooo}
It says it determines a .zip
file, but when unzipping you realise it's a .docx
file so change the extension to get:
flag{xor_is_not_for_security}
Use n
, e
and c
in .
We used to guess the key, setting the keylength to 4 as this was said in the briefing.
We then used to XOR the file with the key 5a 41 99 bb
So first we see that running the program slowly decrypts the string to yield a flag - but it's simply not fast enough. It never ends - we can check by putting a print()
statement at the end. So, we'll have to somehow make it go faster - and to do this we need to work out what the functions do.
The b()
function looks like this:
If we have a look at what it's doing, it seems to be reversing the input and comparing the two - so it returns True
if the inputted number is palidromic, and False
if it is not. We can't really make this more efficient, at least noticably.
The a()
function, however, looks like this:
What this seems to be doing is looping through every value from 2
to n-1
and checking if n
is divisible by it - a way of checking if it's prime. However, this is incredibly inefficient, and is probably the reason it takes so long. Let's make it more efficient and see if it does something.
We are going to use the sympy
function isprime
to change a()
:
Running this program spits out the full flag much faster now.
flag{pR1m3s_4re_co0ler_Wh3n_pal1nDr0miC}