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