Comments on: [EKOPARTY PRE-CTF 2015] [Cry200 – Perfect security] Write Up https://0x90r00t.com/2015/09/20/ekoparty-pre-ctf-2015-cry200-perfect-security-write-up/ 0x90r00t, 0x90r00f Mon, 18 Jan 2016 20:04:44 +0000 hourly 1 https://wordpress.org/?v=6.6.2 By: Alkanor https://0x90r00t.com/2015/09/20/ekoparty-pre-ctf-2015-cry200-perfect-security-write-up/#comment-3920 Mon, 18 Jan 2016 20:04:44 +0000 https://0x90r00t.com/?p=1313#comment-3920 In reply to Niemand.

Hi Niemand,

the crypted text is composed of letters from a to z and of digits from 0 to 9 (or maybe I converted it, I don’t remember honestly). That’s why I use a comparaison with ‘9’ : when char is not <= '9', we can be sure it is located between 'a' and 'f'. Basically the code you mentioned is a conversion from 'xx' (2 hex string) to char.
(for instance, '10' is converted to char 16, 'a2' is converted to char 162, …)

Secondly, I chose the golden number size in order to have a valid file at the end of the process, so that can explain it isn't exactly the same size as output.enc (I modified it a posteriori).

Hope it's understandable,
best,
Alkanor

]]>
By: Niemand https://0x90r00t.com/2015/09/20/ekoparty-pre-ctf-2015-cry200-perfect-security-write-up/#comment-3790 Wed, 13 Jan 2016 13:02:19 +0000 https://0x90r00t.com/?p=1313#comment-3790 Hello Alkanor,

I’m currently learning more about the CTF reading and learning from your posts. Therefore, I’d like to ask something about your code, because I can’t understand the way you did it.

if(crypted[i]<='9'&&crypted[i+1]<='9')
hex.push_back((crypted[i]-'0')*16+(crypted[i+1]-'0'));
else if(crypted[i]<='9')
hex.push_back((crypted[i]-'0')*16+(crypted[i+1]-'a'+10));
else if(crypted[i+1]<='9')
hex.push_back((crypted[i]-'a'+10)*16+(crypted[i+1]-'0'));
else
hex.push_back((crypted[i]-'a'+10)*16+(crypted[i+1]-'a'+10));

I really don't understand why you are taking two numbers and comparing them to '9'. If you could explain my how it works I would really appreciate it.

Second, why the golden number size is shorter than the output.enc? Shouldn't be the same size or longer?

Best,
Niemand

]]>