Another gift: Crackme #1 source code from hell!

A reader was asking me some questions related to some stuff I used in my crackme and I decided to release its source code. Enough time went by already and I do not think it has many important secrets.

Now, you will have to forgive me but that is one hell of ugly source code! I just cleaned up some dead code and some other minor cleanups. Right now I do not have enough time to fix and clean up the code, even if I really do not like it at all. Maybe I will leave that for Crackme #2 one of these days.

If you have enough patience to read the messy code there are interesting bits and pieces of code that implement interesting things in OS X. Some are probably not the best approaches but the core concepts are there.
Source code contains some auxiliary and test utils to test some of the concepts used in the keygen. The most interesting one is probably the Mach-O header mangler.

Feel free to ask any questions, I will try to help if I can remember it.

Source code available here https://github.com/gdbinit/crackme_nr1.

Enjoy and I hope to see soon your own OS X crackmes,
fG!