Friday, February 18, 2005

Some crap from college

Ok. Here's something completely unrelated to things I usually write here :)

For one course at my college I was required to write so odd-ass code, and I thought someone would be interested to take a look.
The first thingie is a primitive digital signaturing tool for executable files. It works by scanning the compiled code for a free segment and writes a RSA signed key part that can be verified later, if needed.
The code is on Python script that patches the original program for watermarking, and creates a new script that can be used to verify the watermark. It was an interesting experiment with public-key cryptography and RSA, and was rather entertaining.
Anyway, here's the code. [link]

The second thing is an alternative for GNU's Gettext program. It scans the source code of C/C++ program and extracts all the strings, and prepares the source code for automatic translation. There were 3 versions of this program.
First was a fun one, coded in Python, where I used Finite State Machine method. It worked flawlessly but was immensly slow because I used char-by-char processing of the text, which was totally un-efficient.
Here's the [code].
Here's the FSM's [code].
Here's the diagram of the FSM: [picture].

Second was a rewrite, without any FSM, using regular expression. This one was extremly fast, but later found out that Python's regex engine is very weak, and crashes horribly on deep recursions in the expression. That was very discouraging, since I became a real Python fanatic and that was disappointing.
Here's the [code].

The last version was rewritten in Perl with basicly the same code - but it worked twise as fast and didn't crash at all! Odd stuff...
Here's the [code] :)

All this was probably a total waste of your reading time... But it's my blog so... Stuff it! ;)

No comments: