[plt-scheme] crypt() implementation?
Quoth Matthew Flatt on Thursday, August 14, 2003:
> Does anyone have an implementation of the Unix crypt() function (that
> doesn't involve calling out to the C implementation)? Or something that
> does the same job at least as well?
Do you mean you want a pure Scheme implementation, or can it be in C as
long as it doesn't depend on crypt()?
If it's the former, here's a pure Scheme implementation of MD5 which,
with the addition of a random salt, would work fine for password
hashing:
http://www.scheme.dk/md5/
If it's the latter, there are a few possibilities. You could use the
crypt() source code from one of the BSDs. OpenBSD's version looks like
a good candidate:
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/crypt/crypt.c
Or you could use one of the hash libraries on the Libraries and
Extensions page. The Digest library implements MD5, is self contained,
but needs to be updated for 205. The mhash wrapper that I contributed
implements all sorts of hash algorithms, but requires an external C
library.
--
Pat Ekman