August 2006


Finally, I have had some time to finish the Scheme code that generates the MySQL client auth protocol messages. The SHA1 implementation seems to work fine, although it’s quite slow: The specification contains a test case that consists of calculating the hash value of one million a characters. This test took 35 minutes on a 3 GHz Pentium III processor… So, you probably don’t want to replace /sbin/sha1 with the Scheme implementation yet…

However, for small messages, such as the MySQL passwords, the implementation is fast enough. Next on my list: Generating query messages and reading replies. Doesn’t look too complicated. Here’s my code (as a darcs repository):

http://www-pu.informatik.uni-tuebingen.de/users/knauel/sw/myscsh/

Technorati Tags: , ,

News on my favorite low priority, by the way project: a pure Scheme implementation of the MySQL protocol. Login for user accounts without passwords seems to work fine. The next thing is to implement the MySQL password algorithm. This involves the SHA1 cryptographic hash functions. There are plenty of implementations in C which I could have used via FFI bindings. However, I didn’t like the idea of an “impure” part in the protocol implementation. Especially not, if the impure part only does some integer arithmetic.

So, I wrote an SHA1 implementation in Scheme. This was a quite nice experience, SHA1 deals with 512 bit message blocks which can easily represented as a bignum in Scheme. The code for chopping the input message into 512 bit blocks is still not complete (preprocessing the message is actually an annoying task), but once this works I hope I can login into MySQL with a password.

Technorati Tags: , ,

I’m pretty happy with MacBookPro: For me the transition to an Intel based Mac worked very well. Not problems at all. So far. Till now. This one is really scary:

Welcome to Scheme 48 1.3 (made by knauel on Sat Apr  1 18:38:35 MST 2006)
[...]
> (* 3 1.0)
5.307579804e-315

The scary thing is that this only happens when I use the of on a PPC system—the same calculation with exactly the same binary on the MacBookPro yields the correct result. A PPC binary on a PPC machine also calculates the correct result…

Technorati Tags: