Hackthebox | Crypto | Brainy’s Cipher
The paragraph below opened the challenged
Brainy likes playing around with esoteric programming. He also likes math and has therefore encrypted his very secure password with a popular encryption algorithm. Claiming that his password cannot be retrieved now, he has sent the ciphertext to some of his friends. Can you prove to Brainy that his password can actually be recovered?
From there I got a clue and search online regarding Esoteric Programming. The challenge is more on Crypto so I dig more on “Esoteric Programming Decoder” which return two results that caught my attention.
I opened the brainy.txt file provided in the challenge
You may see the actual content here:
I used the content from brainy.txt to the two decoders above but the brainfuck language decoder give a more positive response
Here’s the decoded content for reference
I noticed the five key RSA values: “p, q, dp, dq, and c” which led me to searched about RSA Cryptography on wikipedia and get a hint about Chinese Remainder Algorithm.
Another reference help me about RSA https://www.di-mgt.com.au/crt_rsa.html
Then I continue my search about modular inverse https://stackoverflow.com/questions/4798654/modular-multiplicative-inverse-function-in-python
which is a big help so I came up with this python code to get the flag.