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.3144
1 files changed, 0 insertions, 144 deletions
diff --git a/src/lib/libc/crypt/crypt.3 b/src/lib/libc/crypt/crypt.3
deleted file mode 100644
index 6a21571ddb..0000000000
--- a/src/lib/libc/crypt/crypt.3
+++ /dev/null
@@ -1,144 +0,0 @@
1.\" $OpenBSD: crypt.3,v 1.46 2025/01/09 23:18:08 jsg Exp $
2.\"
3.\" FreeSec: libcrypt
4.\"
5.\" Copyright (c) 1994 David Burren
6.\" All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution.
16.\" 4. Neither the name of the author nor the names of other contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" Manual page, using -mandoc macros
33.\"
34.Dd $Mdocdate: January 9 2025 $
35.Dt CRYPT 3
36.Os
37.Sh NAME
38.Nm crypt ,
39.Nm bcrypt_gensalt ,
40.Nm bcrypt
41.Nd password hashing
42.Sh SYNOPSIS
43.In stdlib.h
44.Pp
45.In unistd.h
46.Ft char *
47.Fn crypt "const char *key" "const char *setting"
48.In pwd.h
49.Ft char *
50.Fn bcrypt_gensalt "u_int8_t log_rounds"
51.Ft char *
52.Fn bcrypt "const char *key" "const char *salt"
53.Sh DESCRIPTION
54These functions are deprecated in favor of
55.Xr crypt_checkpass 3
56and
57.Xr crypt_newhash 3 .
58.Pp
59The
60.Fn crypt
61function performs password hashing.
62Additional code has been added to deter key search attempts and to use
63stronger hashing algorithms.
64.Pp
65The first argument to
66.Fn crypt
67is a NUL-terminated
68string
69.Fa key ,
70typically a user's typed password.
71The second,
72.Fa setting ,
73currently supports a single form.
74If it begins
75with a string character
76.Pq Ql $
77and a number then a different algorithm is used depending on the number.
78At the moment
79.Ql $2
80chooses Blowfish hashing; see below for more information.
81.Ss Blowfish crypt
82The Blowfish version of crypt has 128 bits of
83.Fa salt
84in order to make building dictionaries of common passwords space consuming.
85The initial state of the
86Blowfish cipher is expanded using the
87.Fa salt
88and the
89.Fa password
90repeating the process a variable number of rounds, which is encoded in
91the password string.
92The maximum password length is 72.
93The final Blowfish password entry is created by encrypting the string
94.Pp
95.Dq OrpheanBeholderScryDoubt
96.Pp
97with the Blowfish state 64 times.
98.Pp
99The version number, the logarithm of the number of rounds and
100the concatenation of salt and hashed password are separated by the
101.Ql $
102character.
103An encoded
104.Sq 8
105would specify 256 rounds.
106A valid Blowfish password looks like this:
107.Pp
108.Dq $2b$12$FPWWO2RJ3CK4FINTw0Hi8OiPKJcX653gzSS.jqltHFMxyDmmQ0Hqq .
109.Pp
110The whole Blowfish password string is passed as
111.Fa setting
112for interpretation.
113.Sh RETURN VALUES
114The function
115.Fn crypt
116returns a pointer to the encrypted value on success, and
117.Dv NULL
118on failure.
119.Sh SEE ALSO
120.Xr encrypt 1 ,
121.Xr login 1 ,
122.Xr passwd 1 ,
123.Xr blowfish 3 ,
124.Xr crypt_checkpass 3 ,
125.Xr getpass 3 ,
126.Xr passwd 5
127.Sh HISTORY
128An M-209 based
129.Fn crypt
130function appeared in
131.At v3 .
132A DES-based
133.Fn crypt
134first appeared in
135.At v7 .
136.Fn bcrypt
137first appeared in
138.Ox 2.1 .
139.Sh BUGS
140The
141.Fn crypt
142function returns a pointer to static data, and subsequent calls to
143.Fn crypt
144will modify the same object.