HP C/iX Library Reference Manual (30026-90004)
Chapter 5 129
HP C/iX Library Function Descriptions
crypt
crypt
Provides one-way encryption of passwords.
Syntax
char *crypt (char *
key, char *salt
);
Parameters
key
A pointer to a character string to be encrypted.
salt
A pointer to a character string used as the initial value in the hashing
algorithm.
Return Values
x A pointer to a character string containing the encrypted password.
Description
The crypt function is the password encryption function based on the NBS Data
Encryption Standard (DES). It is a one-way algorithm that produces a scrambled
character string based upon the input string. It includes variations from the DES intended
to frustrate the use of hardware implementations of the DES for key search.
The
key
parameter is your typed password. The
salt
parameter is a two-character string
chosen from the set [a-zA-Z0-9./]; this string is used to set the hashing algorithm in one
of 4096 different ways, after which
key
is used to encrypt repeatedly a constant string. The
returned value points to the encrypted password; the first two characters of the password
is the
salt
itself.
The return value points to static data that are overwritten by each call.
See Also
setkey(), encrypt()