Research V7 development
[unix-history] / usr / man / man3 / crypt.3
CommitLineData
497e25ef
RM
1.TH CRYPT 3
2.SH NAME
3crypt, setkey, encrypt \- DES encryption
4.SH SYNOPSIS
5.B char *crypt(key, salt)
6.br
7.B char *key, *salt;
8.PP
9.B setkey(key)
10.br
11.B char *key;
12.PP
13.B encrypt(block, edflag)
14.br
15.B char *block;
16.SH DESCRIPTION
17.I Crypt
18is the password encryption routine.
19It is based on the NBS Data Encryption Standard, with
20variations intended (among other things) to frustrate use of hardware
21implementations of the DES for key search.
22.PP
23The first argument to
24.I crypt
25is a user's typed password.
26The second is a 2-character string chosen from the
27set [a-zA-Z0-9./].
28The
29.I salt
30string is used to perturb the DES algorithm in one of 4096
31different ways, after which the password
32is used as the key to encrypt repeatedly a constant string.
33The returned value points to the encrypted password,
34in the same alphabet as the salt.
35The first two characters are the salt itself.
36.PP
37The other entries provide (rather primitive)
38access to the actual DES algorithm.
39The argument of
40.I setkey
41is a character array of length 64 containing only the characters
42with numerical value 0 and 1.
43If this string is divided into groups of 8,
44the low-order bit in each group is ignored,
45leading to a 56-bit key which is set into the machine.
46.PP
47The argument to the
48.I encrypt
49entry is likewise a character array of length 64
50containing 0's and 1's.
51The argument array is modified in place
52to a similar array
53representing the bits of the argument after having been
54subjected to the DES algorithm using the key set by
55.I setkey.
56If
57.I edflag
58is 0, the argument is encrypted;
59if non-zero,
60it is decrypted.
61.SH "SEE ALSO"
62passwd(1), passwd(5), login(1), getpass(3)
63.SH BUGS
64The return value
65points to static data whose content is overwritten
66by each call.