CRYPT(3C) STANDARD C LIBRARY CRYPT(3C)
NAME
crypt, setkey, encrypt -- generate hashing encryption
SYNOPSIS
#include <unistd.h>
char *crypt(const char *key, const char *salt);
void setkey(const char *key);
void encrypt(char *block, int edflag);
DESCRIPTION
crypt is the password-encryption function. It is based on a
one-way hashing encryption algorithm with variations
intended to discourage use of hardware implementations of a
key search (among other things).
key is a user's typed password. salt is a two-character
string chosen from the set (a-zA-Z0-9./). This string is
used to disturb the hashing algorithm in one of 4096
different ways, after which the password is used as the key
to encrypt a constant string repeatedly. The returned value
points to the encrypted password. The first two characters
are the salt itself.
The setkey and encrypt entries provide access to the
actual hashing algorithm. The argument of setkey is a
character array of 64 bits in length containing only the
characters with a numerical of value 0 and 1. If this
string is divided into groups of 8, the low-order bit in
each group is ignored; this produces a 56-bit key that is
set into the machine. This is the key that is used with the
hashing algorithm to encrypt the string block with the
encrypt function.
The argument to the encrypt entry is a character array of 64
bits in length containing only the characters with a numeri-
cal value of 0 and 1. The argument array is modified (in
place) to a similar array representing the bits of the argu-
ment after being subjected to the hashing algorithm. It
uses the key set by setkey. ignored is unused by encrypt,
but it must be present.
SEE ALSO
login(1), passwd(1), getpass(3C), passwd(4)
NOTES
The return value points to static data that is overwritten
by each call.
SUPER-UX Last change: Nov 18, 1996 1
G1AB02E Programmer's Reference Manual