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