Take a look at the following url :
http://programming.ccp14.ac.uk/ftp-mirror/programming/cygwin/pub/cygwin/latest/crypt/
The crypt.c library implemented in that source is the same one that is implemeted under php. We have successfully implented this algorithm with one of our programs (take a look at its licensing though), and have been able to check against passwords successfully.