CRYPT(3,L) AIX Technical Reference CRYPT(3,L)
-------------------------------------------------------------------------------
crypt, encrypt, setkey
PURPOSE
Encrypts user passwords.
LIBRARY
Standard C Library (libc.a)
SYNTAX
void encrypt (block, edflag)
char *crypt (key, salt) char *block;
char *key, *salt; int edflag;
void setkey (key)
char *key;
DESCRIPTION
The crypt and encrypt subroutines encrypt user passwords. They are based on a
hashing encryption algorithm with variations intended to frustrate the use of
hardware-implemented key searches. These subroutines are provided for
compatibility with UNIX system implementations, and no assertion is made about
the strength of the algorithm.
The key parameter is a user's typed password. The salt parameter is a
two-character string chosen from the set ["a-zA-Z0-9./"].
The salt parameter is used to perturb the hashing algorithm in one of 4096
different ways, after which the password is used as the key to repeatedly
encrypt a constant string. The return value points to the encrypted password.
The first two characters of the return value are the string entered in the salt
parameter.
The crypt subroutine uses a character array of length 64 containing only the
values "(char) 0" and "(char) 1". This string is divided into groups of eight
characters each, and the low-order bit in each group is ignored. This provides
a 56-bit key, which is set into the machine by crypt.
The other subroutines provide a somewhat primitive access to the actual hashing
algorithm.
The key parameter to setkey is a character array of length 64, containing only
the characters with numerical value 0 and 1. If this string is divided into
Processed November 7, 1990 CRYPT(3,L) 1
CRYPT(3,L) AIX Technical Reference CRYPT(3,L)
groups of eight, the low-order bit in each group is ignored, leading to a
56-bit key which is set into the machine.
The block parameter to the encrypt subroutine is also a 64-character array
containing only the values (char) 0 and (char) 1. encrypt modifies this array
in place, producing a similar array that has been subjected to the hashing
algorithm using the key set by crypt or setkey. If the edflag parameter is 0,
the argument is encrypted; if nonzero, it is decrypted.
Note: Depending on license agreements, the setkey function and the decrypt
capability of encrypt may be disabled.
RETURN VALUE
The crypt subroutine returns a pointer to the encrypted password. The first
two characters of it are the same as the salt parameter.
Note: The return value points to static data that is overwritten by subsequent
calls.
ERROR CONDITIONS
The crypt, encrypt, and setkey subroutines fail if the following is true:
ENOSYS This functionality is not supported in this implementation.
RELATED INFORMATION
In this book: "getpass" and "passwd."
The login and passwd commands in AIX Operating System Commands Reference.
Processed November 7, 1990 CRYPT(3,L) 2