Rudiments
Static Public Member Functions
crypt Class Reference

List of all members.

Static Public Member Functions

static char * encrypt (const char *password, const char *salt)
static bool needsMutex ()
static void setMutex (mutex *mtx)

Detailed Description

The crypt class provides an encryption method that is commonly used for password encryption.


Member Function Documentation

static char* crypt::encrypt ( const char *  password,
const char *  salt 
) [static]

Encrypts "password" using the des algorithm and "salt" (which should be a 2 character string from the set [a-zA-Z0-9./].

Returns the encrypted password on success or NULL on failure.

Note that this method allocates a buffer internally and returns it. The calling program must deallocate this buffer.

static bool crypt::needsMutex ( ) [static]

If your system doesn't support crypt_r() then this class needs a mutex to assure thread safety.

This method returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.

static void crypt::setMutex ( mutex mtx) [static]

Allows you to supply a mutex is the class needs it. If your application is not multithreaded, then there is no need to supply a mutex.