40 lines
1.8 KiB
Markdown
40 lines
1.8 KiB
Markdown
|
# Tinfoil Hats
|
||
|
## Text
|
||
|
I knew it!!! 5G towers are the cause of corona, and Bill Gates is behind it so that he can inject my child with vaccines!!!! My proof? I recently caught an RSA-encrypted message from my healing crystal. Decrypt it and you will see I am right!
|
||
|
|
||
|
## Files
|
||
|
- message.txt
|
||
|
|
||
|
## How To Solve
|
||
|
Difficulty: Medium
|
||
|
|
||
|
You get the encrypted message c, the n and the e. You must decrypt the message by doing c^d mod n. Of course, d is unknown and must be calculated by figuring out the prime numbers p & q and following the steps on https://simple.wikipedia.org/wiki/RSA_algorithm#Operation .
|
||
|
|
||
|
Finding p & q is the hardest part, since this is hard to calculate. p & q can be found my factorizing n. An easy program exists online: http://factordb.com/index.php however it can also be programmed and is of course encouraged. The numbers are low enough to be handled by most language's precisions.
|
||
|
|
||
|
Finding the totient is trivial from here: (p - 1) * (q - 1).
|
||
|
|
||
|
Finding d is a little tough. Doing it by checking if (d * e) = 1 (mod totient(n)) can take forever. Instead, use multiplicative inverse (also known as the euclidean algorithm). Don't do it by hand of course, make your own function or use one from a library.
|
||
|
|
||
|
Now you found d, you can decrypt c to m. m is a decimal number which can be converted to hex and then to ascii.
|
||
|
|
||
|
Here are all the numbers:
|
||
|
|
||
|
- p = 171752414119518144690025286131
|
||
|
- q = 517131641165158377870109085359
|
||
|
|
||
|
- n = 88818607787704338404083049305208445503399093673026677856029
|
||
|
- ϕ(n) = 88818607787704338404083049304519561448114417150466543484540
|
||
|
|
||
|
- e = 7
|
||
|
- d = 25376745082201239544023728372719874699461262042990440995583
|
||
|
|
||
|
- flag = IGCTF{sHuTupK4r3N}
|
||
|
- hexed = 49474354467b7348755475704b3472334e7d
|
||
|
- decimal = 6383446416928087757016184389928116288704125
|
||
|
|
||
|
- c = 56140388207931376067333633915402785769944433685867841316837
|
||
|
|
||
|
## Flag
|
||
|
IGCTF{sHuTupK4r3N}
|