Rudiments: crypt Class Reference

Rudiments

- Main Page
- Classes

- Class List
- Class Hierarchy
- Class Members

Static Public Member Functions | List of all members
crypt Class Reference

## Static Public Member Functions
static char * | encrypt (const char *password, const char *salt)
static bool | needsMutex ()
static void | setMutex (threadmutex *mtx)

## Detailed Description

The crypt class provides a static 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 | ( | threadmutex * | 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.