crypt.3
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 130 行
3
130 行
.TH crypt 3 .SH Namecrypt, crypt16, setkey, encrypt \- DES encryption.SH Syntax.nf.B char *crypt(\fIkey, salt\fP).B char *\fIkey\fP, *\fIsalt\fP;.PP.B char *crypt16(\fIkey, salt\fP).B char *\fIkey\fP, *\fIsalt\fP;.PP.B void setkey(\fIkey\fP).B char *\fIkey\fP;.fi.SH Description.NXR "encryption" "crypt subroutine".NXR "crypt subroutine" "encryption" .NXR "NBS Data Encryption Standard".NXR "Data Encryption Standard"The.PN cryptsubroutineis the password encryption routine.It is based on the NBS Data Encryption Standard, withvariations intended to frustrate use of hardwareimplementations of the DES for key search..PPThe first argument to.PN cryptis normally a user's typed password.The second is a 2-character string chosen from theset [a-zA-Z0-9./].The.I saltstring is used to perturb the DES algorithm in one of 4096different ways, after which the passwordis used as the key to encrypt repeatedly a constant string.The returned value points to the encrypted password,in the same alphabet as the salt.The first two characters are the salt itself..PPThe.PN crypt16subroutine is identical to the.PN cryptfunction except that it will accept a password up to sixteen charactersin length. It generates a longer encrypted password for use with enhancedsecurity features..PPThe other entries provide primitiveaccess to the actual DES algorithm.The argument of.PN setkeyis a character array of length 64 containing only the characterswith numerical value 0 and 1.If this string is divided into groups of 8,the low-order bit in each group is ignored,leading to a 56-bit key which is set into the machine..PPThe argument to the.PN encryptentry is likewise a character array of length 64containing 0s and 1s.The argument array is modified in placeto a similar arrayrepresenting the bits of the argument after having beensubjected to the DES algorithm using the \fIkey\fP set by.PN setkey .If.I edflagis 0, the argument is encrypted;if non-zero, it is decrypted..SH RestrictionsThe return values from.PN cryptand.PN crypt16point to static data areas whose content is overwrittenby each call..SH Environment.SS Default EnvironmentIn the default environmenton systems that do not have the optional encryption software installedthe.PN encryptfunction expects exactly one argument, the data to be encrypted. The.I edflagargument is not supplied and there is no way to decrypt data.If the optional encryption software is installed the.PN encryptfunction behaves as it does in the POSIX environment.The syntax for the default environment follows:.RS 5.nf.B void encrypt(\fIblock\fP).B char *\fIblock\fP;.fi.RE.SS POSIX Environment.PPIn the POSIX environment the encrypt function always expects two arguments.The.PN encryptfunction will set.I errnoto ENOSYSand return if.I edflagis non-zero and the optional encryption software is notpresent.The syntax for the POSIX environment follows:.RS 5.nf.B void encrypt(\fIblock, edflag\fP).B char *\fIblock\fP;.B int \fIedflag\fP;.fi.RE.PPIn all cases the.PN setkeyfunction will set.I errnoto ENOSYSand return if the optional encryption software is not present..SH See Alsologin(1), passwd(1), yppasswd(1yp), getpass(3), auth(5), passwd(5), passwd(5yp).br\fIULTRIX Security Guide for Users and Programmers\fP
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?