Disclaimer: I know Google, not cryptography.
CRYPT (3) Linux Programmer's Guide
CRYPT (3)
NAME crypt, crypt_r - password and data encryption
SYNTAX
#define _XOPEN_SOURCE #include <unistd.h> char *crypt(const char *key, const char *salt); char *crypt_r(const char *key, const char *salt, struct crypt_data *data);
Link to -lcrypt.
DESCRIPTION
crypt () is a password encryption function. It is based on data encryption algorithm Standard algorithms with variations (among other things) to prevent the use of hardware key search implementations.
Keyis the password entered by the user.
salt is a two-character string selected from the set [a-zA-Z0-9./]. This string is used to perturb the algorithm in one of 4096 different ways.
Taking the least significant 7 bits of each of the first eight characters of a key, a 56-bit key. This 56-bit key is used to encrypt repeatedly a constant string (usually a string consisting of all zeros). The return value indicates an encrypted password, a series of 13 printed ASCII characters (the first two characters represent the salt itself). The return value indicates static data whose contents are overwritten by each call.
Note: The key space consists of 2 ** 56 equal to 7.2e16 possible values. Comprehensive searches for this key space are possible using massively partial-allel computers. Software is available, such as crack (1), which will find part of this key space that people usually use for passwords. Therefore, choosing a password should, at a minimum, avoid common words and names. Using the passwd (1) program, which checks for the use of cracked passwords during the selection process, is recommended.
The DES algorithm itself has several features that make using crypt () a very poor choice for anything but password authentication. If you plan to use the crypt () interface for a cryptographic project, do not do this: get a good book on encryption as well as one of the widely available DES libraries.