diff options
author | Edin Kadribasic <edink@php.net> | 2002-05-10 04:58:05 +0000 |
---|---|---|
committer | Edin Kadribasic <edink@php.net> | 2002-05-10 04:58:05 +0000 |
commit | ffce791942609b37caae439a723f07bc0f0ef58f (patch) | |
tree | 7eca68d8e6f8e52c28ce827def05e30b8e69d861 /win32/crypt_win32.c | |
parent | 0685de942b4a904c1cfc4cb37cda8f377389114d (diff) | |
download | php-git-ffce791942609b37caae439a723f07bc0f0ef58f.tar.gz |
Added MD5 support for crypt() on Windows.
Diffstat (limited to 'win32/crypt_win32.c')
-rw-r--r-- | win32/crypt_win32.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/win32/crypt_win32.c b/win32/crypt_win32.c index 8e4fa228ff..1b2c32959f 100644 --- a/win32/crypt_win32.c +++ b/win32/crypt_win32.c @@ -41,6 +41,7 @@ #include <time.h> #include <string.h> #include <stdlib.h> +#include "md5crypt.h" #define BS 64 #define BS2 32 @@ -271,7 +272,7 @@ setkey (char *schl) } char * -crypt (const char *wort, const char *salt) +des_crypt (const char *wort, const char *salt) { static char retkey[14]; char key[BS + 2]; @@ -343,4 +344,12 @@ crypt (const char *wort, const char *salt) return retkey; } - +char * +crypt (const char *pw, const char *salt) +{ + if (strlen(salt)>MD5_MAGIC_LEN && strncmp(salt, MD5_MAGIC, MD5_MAGIC_LEN)==0) { + return md5_crypt(pw, salt); + } else { + return des_crypt(pw, salt); + } +} |