ch0p5u3y

Seek truths.

real-baby-rsa - TokyoWesterns CTF 2019


    Sat 31 Aug. 2019, 01:00 BST - Mon 2 Sept. 2019, 01:00 BST

    Summary: A beginner crypto challenge which requires basic python scripting skills.

    With this challenge we are given 2 files, the first being a file called output with 27 massive numbers inside of it. The second file is called problem.py and it is a basic python script which has been used to generate the numbers in output.


    The majority of this script is pretty simple, it uses a for loop to iterate through each character in the flag variable and then prints it's output.
    As for the output this is a calculation which uses the pow function along with 3 other variables. The first variable is ord(char) which returns an integer based on the Unicode point of char (e.g. ord("a") returns 97).
    The next variable is e which is the number that will be powered with our first variable.
    And the final variable N is our large number which will be used for the modulus operation on the result of the previous two variables. So we now know how the script is encrypting the flag and we can work towards decrypting it by borrowing some of the code from problem.py and using it inside our own script!


    Here is the output of the script I wrote, it isn't the most elegant code but it works. Let's put these into order and see what we get!


    Looks like we're missing a few letters, specifically the 4th, 10th, 15th, 17th, 18th, 20th, 24th, 25th and 26th letters. However this isn't an issue as these missing letters are merely just duplicates hence why the script hasn't printed them. All we need to do is search for the value of each missing letter in our script and match them up with the ones we already know and voila!

© ch0p5u3y 2019