#include "sha1/sha1.h"
#include "random128/random128.h"
-static const char rcsid[]="$Id: cryptpassword.c,v 1.13 2008/12/25 14:52:38 mrsam Exp $";
#if HAVE_CRYPT
#if NEED_CRYPT_PROTOTYPE
static const char crypt_salt[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./";
-static const char *crypt_hash(const char *pw)
-{
- random128binbuf randbuf;
- char salt[3];
-
- random128_binary(&randbuf);
-
- salt[0]=crypt_salt[ randbuf[0] % 64 ];
- salt[1]=crypt_salt[ randbuf[1] % 64 ];
- salt[2]=0;
-
- return (crypt(pw, salt));
-}
-
static const char *ssha_hash_int(const char *pw)
{
random128binbuf randbuf;
if (!hash_func)
{
- hash_func= &crypt_hash;
- pfix="{CRYPT}";
+ hash_func= &ssha_hash_int;
+ pfix="{SSHA}";
}
p= (*hash_func)(password);