Changeset View
Changeset View
Standalone View
Standalone View
lib/libcrypt/crypt.3
Show All 23 Lines | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd March 9, 2014 | .Dd July 25, 2016 | ||||
.Dt CRYPT 3 | .Dt CRYPT 3 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm crypt | .Nm crypt | ||||
.Nd Trapdoor encryption | .Nd Trapdoor encryption | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libcrypt | .Lb libcrypt | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In unistd.h | .In unistd.h | ||||
.Ft char * | .Ft char * | ||||
.Fn crypt "const char *key" "const char *salt" | .Fn crypt "const char *key" "const char *salt" | ||||
.Ft char * | |||||
.Fn crypt_r "const char *key" "const char *salt" "struct crypt_data *data" | |||||
.Ft const char * | .Ft const char * | ||||
.Fn crypt_get_format "void" | .Fn crypt_get_format "void" | ||||
.Ft int | .Ft int | ||||
.Fn crypt_set_format "const char *string" | .Fn crypt_set_format "const char *string" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Fn crypt | .Fn crypt | ||||
function performs password hashing with additional code added to | function performs password hashing with additional code added to | ||||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | |||||
DES | DES | ||||
if it is available, or MD5 if not. | if it is available, or MD5 if not. | ||||
.Pp | .Pp | ||||
How the salt is used will depend upon the algorithm for the hash. | How the salt is used will depend upon the algorithm for the hash. | ||||
For | For | ||||
best results, specify at least eight characters of salt. | best results, specify at least eight characters of salt. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fn crypt_r | |||||
function behaves identically to | |||||
.Fn crypt , | |||||
except that the resulting string is stored in | |||||
.Fa data , | |||||
making it thread-safe. | |||||
.Pp | |||||
The | |||||
.Fn crypt_get_format | .Fn crypt_get_format | ||||
function returns a constant string that represents the name of the | function returns a constant string that represents the name of the | ||||
algorithm currently used. | algorithm currently used. | ||||
Valid values are | Valid values are | ||||
.\" | .\" | ||||
.\" NOTICE: Also make sure to update this, too, as well | .\" NOTICE: Also make sure to update this, too, as well | ||||
.\" | .\" | ||||
.Ql des , | .Ql des , | ||||
.Ql blf , | .Ql blf , | ||||
.Ql md5 , | .Ql md5 , | ||||
.Ql sha256 , | .Ql sha256 , | ||||
.Ql sha512 | .Ql sha512 | ||||
and | and | ||||
.Ql nth . | .Ql nth . | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fn crypt_set_format | .Fn crypt_set_format | ||||
function sets the default encoding format according to the supplied | function sets the default encoding format according to the supplied | ||||
.Fa string . | .Fa string . | ||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||
The | The | ||||
.Fn crypt | .Fn crypt | ||||
function returns a pointer to the encrypted value on success, and NULL on | and | ||||
.Fn crypt_r | |||||
functions return a pointer to the encrypted value on success, and NULL on | |||||
failure. | failure. | ||||
Note: this is not a standard behaviour, AT&T | Note: this is not a standard behaviour, AT&T | ||||
.Fn crypt | .Fn crypt | ||||
will always return a pointer to a string. | will always return a pointer to a string. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fn crypt_set_format | .Fn crypt_set_format | ||||
function will return 1 if the supplied encoding format was valid. | function will return 1 if the supplied encoding format was valid. | ||||
Show All 14 Lines | |||||
.At v7 . | .At v7 . | ||||
.Pp | .Pp | ||||
The | The | ||||
.Tn DES | .Tn DES | ||||
section of the code (FreeSec 1.0) was developed outside the United | section of the code (FreeSec 1.0) was developed outside the United | ||||
States of America as an unencumbered replacement for the U.S.-only | States of America as an unencumbered replacement for the U.S.-only | ||||
.Nx | .Nx | ||||
libcrypt encryption library. | libcrypt encryption library. | ||||
.Pp | |||||
The | |||||
.Fn crypt_r | |||||
function was added in | |||||
.Fx 12.0 . | |||||
.Sh AUTHORS | .Sh AUTHORS | ||||
.An -nosplit | .An -nosplit | ||||
Originally written by | Originally written by | ||||
.An David Burren Aq Mt davidb@werj.com.au , | .An David Burren Aq Mt davidb@werj.com.au , | ||||
later additions and changes by | later additions and changes by | ||||
.An Poul-Henning Kamp , | .An Poul-Henning Kamp , | ||||
.An Mark R V Murray , | .An Mark R V Murray , | ||||
.An Michael Bretterklieber , | .An Michael Bretterklieber , | ||||
Show All 20 Lines |