summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt/crypt.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/crypt/crypt.3')
-rw-r--r--src/lib/libc/crypt/crypt.387
1 files changed, 8 insertions, 79 deletions
diff --git a/src/lib/libc/crypt/crypt.3 b/src/lib/libc/crypt/crypt.3
index f6373c5125..c8ebf9861d 100644
--- a/src/lib/libc/crypt/crypt.3
+++ b/src/lib/libc/crypt/crypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: crypt.3,v 1.44 2014/12/08 20:46:04 tedu Exp $ 1.\" $OpenBSD: crypt.3,v 1.45 2015/04/06 20:49:41 tedu Exp $
2.\" 2.\"
3.\" FreeSec: libcrypt 3.\" FreeSec: libcrypt
4.\" 4.\"
@@ -31,7 +31,7 @@
31.\" 31.\"
32.\" Manual page, using -mandoc macros 32.\" Manual page, using -mandoc macros
33.\" 33.\"
34.Dd $Mdocdate: December 8 2014 $ 34.Dd $Mdocdate: April 6 2015 $
35.Dt CRYPT 3 35.Dt CRYPT 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
@@ -58,8 +58,7 @@ and
58.Pp 58.Pp
59The 59The
60.Fn crypt 60.Fn crypt
61function performs password hashing based on the 61function performs password hashing.
62NBS Data Encryption Standard (DES).
63Additional code has been added to deter key search attempts and to use 62Additional code has been added to deter key search attempts and to use
64stronger hashing algorithms. 63stronger hashing algorithms.
65.Pp 64.Pp
@@ -71,15 +70,7 @@ string
71typically a user's typed password. 70typically a user's typed password.
72The second, 71The second,
73.Fa setting , 72.Fa setting ,
74is in one of three forms: 73currently supports a single form.
75if it begins with an underscore
76.Pq Ql _
77then an extended format is used
78in interpreting both the
79.Fa key
80and the
81.Fa setting ,
82as outlined below.
83If it begins 74If it begins
84with a string character 75with a string character
85.Pq Ql $ 76.Pq Ql $
@@ -87,28 +78,6 @@ and a number then a different algorithm is used depending on the number.
87At the moment 78At the moment
88.Ql $2 79.Ql $2
89chooses Blowfish hashing; see below for more information. 80chooses Blowfish hashing; see below for more information.
90.Ss Extended crypt
91The
92.Fa key
93is divided into groups of 8 characters (the last group is null-padded)
94and the low-order 7 bits of each character (56 bits per group) are
95used to form the DES key as follows:
96the first group of 56 bits becomes the initial DES key.
97For each additional group, the XOR of the encryption of the current DES
98key with itself and the group bits becomes the next DES key.
99.Pp
100The
101.Fa setting
102is a 9-character array consisting of an underscore followed
103by 4 bytes of iteration count and 4 bytes of salt.
104These are encoded as printable characters, 6 bits per character,
105least significant character first.
106The values 0 to 63 are encoded as
107.Dq \&./0-9A-Za-z .
108This allows 24 bits for both
109.Fa count
110and
111.Fa salt .
112.Ss Blowfish crypt 81.Ss Blowfish crypt
113The Blowfish version of crypt has 128 bits of 82The Blowfish version of crypt has 128 bits of
114.Fa salt 83.Fa salt
@@ -141,42 +110,6 @@ A valid Blowfish password looks like this:
141The whole Blowfish password string is passed as 110The whole Blowfish password string is passed as
142.Fa setting 111.Fa setting
143for interpretation. 112for interpretation.
144.Ss Traditional crypt
145The first 8 bytes of the
146.Fa key
147are null-padded, and the low-order 7 bits of
148each character is used to form the 56-bit DES key.
149.Pp
150The
151.Fa setting
152is a 2-character array of the ASCII-encoded salt.
153Thus only 12 bits of
154.Fa salt
155are used.
156.Fa count
157is set to 25.
158.Ss DES Algorithm
159The
160.Fa salt
161introduces disorder in the DES
162algorithm in one of 16777216 or 4096 possible ways
163(i.e., with 24 or 12 bits: if bit
164.Em i
165of the
166.Fa salt
167is set, then bits
168.Em i
169and
170.Em i+24
171are swapped in the DES E-box output).
172.Pp
173The DES key is used to encrypt a 64-bit constant using
174.Fa count
175iterations of DES.
176The value returned is a NUL-terminated
177string, 20 or 13 bytes (plus NUL) in length, consisting of the
178.Fa setting
179followed by the encoded 64-bit encryption.
180.Sh RETURN VALUES 113.Sh RETURN VALUES
181The function 114The function
182.Fn crypt 115.Fn crypt
@@ -196,20 +129,16 @@ A rotor-based
196.Fn crypt 129.Fn crypt
197function appeared in 130function appeared in
198.At v3 . 131.At v3 .
199The current style 132A DES-based
200.Fn crypt 133.Fn crypt
201first appeared in 134first appeared in
202.At v7 . 135.At v7 .
203.Sh AUTHORS 136.Fn bcrypt
204.An David Burren Aq Mt davidb@werj.com.au 137first appeared in
205wrote the original DES functions. 138.Ox 2.1 .
206.Sh BUGS 139.Sh BUGS
207The 140The
208.Fn crypt 141.Fn crypt
209function returns a pointer to static data, and subsequent calls to 142function returns a pointer to static data, and subsequent calls to
210.Fn crypt 143.Fn crypt
211will modify the same object. 144will modify the same object.
212.Pp
213With DES hashing, passwords containing the byte 0x80 use less key entropy
214than other passwords.
215This is an implementation bug, not a bug in the DES cipher.