90 lines
2.2 KiB
Plaintext
90 lines
2.2 KiB
Plaintext
'\"macro stdmacro
|
|
.if n .pH g3c.crypt @(#)crypt 30.2 of 12/30/85
|
|
.nr X
|
|
.if \nX=0 .ds x} CRYPT 3C "C Programming Language Utilities" "\&"
|
|
.if \nX=1 .ds x} CRYPT 3C "C Programming Language Utilities"
|
|
.if \nX=2 .ds x} CRYPT 3C "" "\&"
|
|
.if \nX=3 .ds x} CRYPT "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
crypt, setkey, encrypt \- generate hashing encryption
|
|
.SH SYNOPSIS
|
|
.B "#include <crypt.h>"
|
|
.PP
|
|
.B "char \(**crypt(const char \(**key, const char \(**salt);
|
|
.PP
|
|
.B "void setkey(const char \(**key);
|
|
.PP
|
|
.B "void encrypt(const char \(**block, int ignored);
|
|
.SH DESCRIPTION
|
|
.I crypt\^
|
|
is the password encryption function.
|
|
It is based on a one way hashing encryption algorithm
|
|
with
|
|
variations intended (among other things) to frustrate use of hardware
|
|
implementations of a
|
|
key search.
|
|
.PP
|
|
.I Key\^
|
|
is the input string to encrypt, for instance, a user's typed password.
|
|
.I Salt\^
|
|
is a two-character string chosen from the
|
|
set [\f3a-zA-Z0-9.\/\fP];
|
|
this
|
|
string is used to perturb the
|
|
hashing
|
|
algorithm in one of 4096
|
|
different ways, after which the password
|
|
is used as the key to encrypt repeatedly a constant string.
|
|
The returned value points to the encrypted password.
|
|
The first two characters are the salt itself.
|
|
.PP
|
|
The
|
|
.I setkey\^
|
|
and
|
|
.I encrypt\^
|
|
entries provide (rather primitive)
|
|
access to the actual
|
|
hashing
|
|
algorithm.
|
|
The argument of
|
|
.I setkey\^
|
|
is a character array of length 64 containing only the characters
|
|
with numerical value 0 and 1.
|
|
If this string is divided into groups of 8,
|
|
the low-order bit in each group is ignored;
|
|
this gives a 56-bit key which is set into the machine.
|
|
This is the key that will be used
|
|
with the hashing algorithm to encrypt
|
|
the string
|
|
.I block\^
|
|
with the function
|
|
.IR encrypt .
|
|
.PP
|
|
The argument to the
|
|
.I encrypt\^
|
|
entry is a character array of length 64
|
|
containing only the characters with
|
|
numerical value 0 and 1.
|
|
The argument array is modified in place
|
|
to a similar array
|
|
representing the bits of the argument after having been
|
|
subjected to the
|
|
hashing
|
|
algorithm using the key set by
|
|
.IR setkey .
|
|
.I Ignored
|
|
is unused by
|
|
.I encrypt\^
|
|
but it must be present.
|
|
.SH SEE ALSO
|
|
login(1), passwd(1),
|
|
getpass(3C), passwd(4)
|
|
.SH CAVEAT
|
|
The return value
|
|
points to static data that are overwritten
|
|
by each call.
|
|
'\".so /pubs/tools/origin.att
|
|
.\" @(#)crypt.3c 6.2 of 10/20/83
|
|
.Ee
|