[Vince Vielhaber]
| Works for me.
Ok, here's the source. Please note the following:
* You should change the typedefs in md5.c. I guess the PostgreSQL
source has types that are correct for various platforms. I've run
this on Linux (x86) only.
* I use the Artistic License. Feel free to replace it with the
license used in the rest of PostgreSQL.
* I tested my implementation (or rather, the translation to C) by
generating MD5 sums for all files in my /usr/local/bin, and
comparing the sums with those generated by GNU's md5sum program.
You may want to do further tests.
* Although I've written tens of thousands of lines of C code in
the past, it is almost three years since the last time I did. Java
programming has made me rather relaxed when it comes to memory
handling, so you should look for pointer problems and failure to
free allocated memory. :-)
* Salting is left to the caller. You will probably want to build
convenience functions on top of md5_hash.
I really hope you will find the code useful, as it is my secret wish
to contribute to PostgreSQL. :-)
Please keep me informed on what you do with the code, even if you
choose to throw it in /dev/null.
Sverre.
--
<URL:mailto:sverrehu@online.no>
<URL:http://home.sol.no/~sverrehu/> Echelon bait: semtex, bin Laden,
plutonium, North Korea, nuclear bomb