© Noiche

char nick[] = "N0iche";

printf("https://www.root-me.org/%s\n", nick);

printf("%s\x40protonmail\x2ecom\n", nick);

[DGHACK-2020] - Crypto - Involucrypt (1&2)

Dec 3, 2020 • Write-Up,DGHACK-2020,Crypto

Challenge details :

CTF Challenge Category Value Solves lvl 1 Solves lvl 2
DGHACK-2020 Involucrypt 1 & 2 Crypto XXX    

Description

TL;DR

Code analysis

The challenge was consisting of a script implementing a Mersenne Twitser algorithm :


This implementation looks pretty clean at first glance, and it seems we won’t be able to break that crypto. Nevertheless, we notice 2 unusual functions, justifying the fact that this algorithm is custom. These 2 functions are keystream and shuffle :


If we take a look at the way a cipher text is generated from a clear text, we understand that the program could be represented like this :

[vue fonctionnelle, schéma]

OK, we know that the program will encrypt 150 characters from the clear text per letter in the key. Because of the shuffle it also looks like we wont be able to bruteforce each letter apart from the others… BUT,