Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

strcrypt.cc

Go to the documentation of this file.
00001 #include "strutils.h"
00002 #include <crypt.h>
00003 
00004 #include <unistd.h>
00005 #include <stdlib.h>
00006 
00007 WvString passwd_crypt(const char *str)
00008 {
00009     static char saltchars[] = 
00010         "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
00011     char salt[3], *result;
00012     
00013     salt[0] = saltchars[random() % (sizeof(saltchars) - 1)];
00014     salt[1] = saltchars[random() % (sizeof(saltchars) - 1)];
00015     salt[2] = 0;
00016         
00017     result = crypt(str, salt);
00018     if (!result)
00019         return "*";
00020 
00021     WvString s(result);
00022     return s;
00023 }

Generated on Sat Mar 13 14:55:16 2004 for WvStreams by doxygen 1.3.6-20040222