⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crypt.3

📁 Unix操作系统minix 2.0源码
💻 3
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:06:35 1996%%Pages: (atend)%%DocumentFonts: (atend)/devps 180 dict def devps begin/res 10.000000 def/y_offset 843 def/X{exch}bind def/mm {transform round X round X itransform} bind def/r{rmoveto}bind def/m{moveto}bind def/l{lineto}bind def/rl{rlineto}bind def/st{stroke}bind def/gs{gsave}bind def/gr{grestore}bind def/cp{currentpoint}bind def/np{newpath}bind def/ct{curveto}bind defsystemdict /setpacking known { /savepacking currentpacking def true setpacking } if/m0{0 0 moveto}bind def/xc{//res div}bind def/yc{//res neg div //y_offset add}bind def/lc{yc X xc X l st}bind def/mc{yc X xc X m}bind def/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def/V{//res neg div //y_offset addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}bind def/h{//res div 0 r}bind def/v{//res neg div 0 X r}bind def/S{X H show}bind def/A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def/psize 10 def/height 0 def/cheight { height 0 ne { height } { psize } ifelse } bind def/slant 0 def/FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def    [psize 0 cheight slant sin slant cos div mul cheight 0 0]    makefont setfont}bind def/shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fillgr}bind def1 setlinecap/resolution res 72 mul def/startFig {	/SavedState save def	userdict maxlength dict begin	currentpoint transform	DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap		setlinewidth setmatrix	itransform moveto	/ury exch def	/urx exch def	/lly exch def	/llx exch def	/y exch 72 mul resolution div def	/x exch 72 mul resolution div def		currentpoint /cy exch def /cx exch def	/sx x urx llx sub div def	/sy y ury lly sub div def	sx sy scale	cx sx div llx sub	cy sy div ury sub translate		/DefFigCTM matrix currentmatrix def	/initmatrix {		DefFigCTM setmatrix	} def	/defaultmatrix {		DefFigCTM exch copy	} def	/initgraphics {		DocumentInitState setmiterlimit setgray setdash 			setlinejoin setlinecap setlinewidth setmatrix		DefFigCTM setmatrix	} def	/showpage {		initgraphics	} def}bind  def/clipFig {	currentpoint 6 2 roll	newpath 4 copy	4 2 roll moveto	6 -1 roll exch lineto	exch lineto	exch lineto	closepath clip	newpath	moveto}bind  def/doclip { llx lly urx ury clipFig } def/endFig {	end SavedState restore}bind  def/globalstart {	fontnum psize slant height resolution currentpoint 	pagesave restore gsave }bind  def/globalend {	grestore moveto	/resolution exch def /height exch def	/slant exch def /psize exch def /fontnum exch def	F	/pagesave save def}bind  def/fontnum 1 def systemdict /setpacking known { savepacking setpacking} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin currentdash currentgray currentmiterlimit ] cvx def}bind def/EP{end cleartomark restore showpage}def/Encoding-1 256 array def0 1 255 {Encoding-1 exch /.notdef put} forEncoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-BEncoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-bEncoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accentsEncoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessiEncoding-1dup 8#41 /copyright putdup 8#42 /registered putdup 8#43 /trademark putdup 8#44 /logicalnot putdup 8#45 /Eth putdup 8#46 /eth putdup 8#47 /Thorn putdup 8#50 /thorn putdup 8#51 /brokenbar putdup 8#52 /degree putdup 8#53 /divide putdup 8#54 /multiply putdup 8#55 /minus putdup 8#56 /onehalf putdup 8#57 /onequarter putdup 8#60 /threequarters putdup 8#101 /Aacute putdup 8#102 /Acircumflex putdup 8#103 /Adieresis putdup 8#104 /Agrave putdup 8#105 /Aring putdup 8#106 /Atilde putdup 8#107 /Ccedilla putdup 8#110 /Eacute putdup 8#111 /Ecircumflex putdup 8#112 /Edieresis putdup 8#113 /Egrave putdup 8#114 /Iacute putdup 8#115 /Icircumflex putdup 8#116 /Idieresis putdup 8#117 /Igrave putdup 8#120 /Ntilde putdup 8#121 /Oacute putdup 8#122 /Ocircumflex putdup 8#123 /Odieresis putdup 8#124 /Ograve putdup 8#125 /Otilde putdup 8#126 /Scaron putdup 8#127 /Uacute putdup 8#130 /Ucircumflex putdup 8#131 /Udieresis putdup 8#132 /Ugrave putdup 8#133 /Ydieresis putdup 8#134 /Zcaron putdup 8#135 /aacute putdup 8#136 /acircumflex putdup 8#137 /adieresis putdup 8#140 /agrave putdup 8#141 /aring putdup 8#142 /atilde putdup 8#143 /ccedilla putdup 8#144 /eacute putdup 8#145 /ecircumflex putdup 8#146 /edieresis putdup 8#147 /egrave putdup 8#150 /iacute putdup 8#151 /icircumflex putdup 8#152 /idieresis putdup 8#153 /igrave putdup 8#154 /ntilde putdup 8#155 /oacute putdup 8#156 /ocircumflex putdup 8#157 /odieresis putdup 8#160 /ograve putdup 8#161 /otilde putdup 8#162 /scaron putdup 8#163 /uacute putdup 8#164 /ucircumflex putdup 8#165 /udieresis putdup 8#166 /ugrave putdup 8#167 /ydieresis putdup 8#170 /zcaron putpop/Enc-dict 30 dict defEnc-dict /tmpstr1 50 string putEnc-dict /tmpstr2 50 string putEnc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put/AEnc-def { % arguments: the original font's name, encoding nrEnc-dict begintmpstr2 cvs /Enc-no exch def % Remember the number in a stringdup /OrigName exch def % remember the namefindfont dup maxlength dict /newdict exch def % get dictionary for new font{ exch dup /FID ne   { exch newdict 3 1 roll put }   { pop pop } % Ignore FID   ifelse} forallnewdict begin/Encoding  tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval  cvn load  def % Replace encodingcurrentdict /UniqueID known{ /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueIDend % newdict/FNlength OrigName tmpstr1 cvs length def % convert name, remember lengthFNlength 1 add Enc-no length add stringdup 0 OrigName tmpstr1 cvs putintervaldup FNlength (-) putintervaldup FNlength 1 add Enc-no putintervaldup 0 tmpstr1 0 FNlength getinterval putinterval % Add old namecvn dup newdict /FontName 3 2 roll put newdict definefontend % Enc-dict} def/Times-Roman 1 AEnc-def pop/R-1{/Times-Roman-1 FF}def/R{/Times-Roman FF}def/B{/Times-Bold FF}def/I{/Times-Italic FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def480 V10 R720(CRYPT)S1053(\()S1095(3)S1153(\))S2696(Eighth)S(Edition)296 2989 A4794(CRYPT)S5127(\()S5169(3)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R1080(crypt)S10 R-11312(-)S10 R1394(one-way)S1766(password)S2171(encryption)S2626(function)S1248 V9 R720(S)S722(SY)S774(YN)S842(NO)S910(OP)S978(PS)S1030(SI)S1082(IS)S1115(S)S1368 V10 B1080(#de\256ne)S(_MINIX_SOURCE)839 1426 A2303(1)S1488 V1080(#include)S1482(<unistd.h>)S1728 V1080(char)S1314(*crypt\(const)S1890(char)S2124(*)S10 I(key)135 2174 A10 B2309(,)S2372(const)S2634(char)S2868(*)S10 I2918(salt)S10 B3063(\))S1896 V9 R720(D)S722(DE)S790(ES)S848(SC)S900(CR)S962(RI)S1024(IP)S1057(PT)S1109(TI)S1167(IO)S1200(ON)S1268(N)S2016 V10 R1080(The)S1266(\256rst)S1452(use)S1615(of)S10 B(crypt\(\))298 1728 A10 R2055(is)S2151(to)S2258(encrypt)S2589(a)S2663(password.)S3122(Its)S(second)279 3252 A3560(use)S3723(is)S3819(to)S3927(authenticate)S4444(a)S4519(shadow)S4856(password.)S2136 V1080(In)S1189(both)S1392(cases)S10 B(crypt\(\))298 1630 A10 R1953(calls)S10 B2163(pwdauth)S10 R2544(\(8\))S2687(to)S2790(do)S2915(the)S3063(real)S3240(work.)S2304 V10 B(Crypt\(\))326 1080 A10 R1432(encrypts)S1799(a)S1870(password)S2276(if)S2364(called)S2631(with)S2836(a)S2907(user)S3101(typed)S3350(key,)S3546(and)S3717(a)S3788(salt)S3954(whose)S4237(\256rst)S4420(two)S4597(characters)S5033(are)S5183(in)S2424 V1080(the)S1238(set)S1385([./0-9A-Za-z].)S2018(The)S2210(result)S2469(is)S2571(a)S2651(character)S3057(string)S3321(in)S3434(the)S3592([./0-9A-Za-z])S4174(alphabet)S4549(of)S4667(which)S4947(the)S5104(\256rst)S2544 V1080(two)S1256(characters)S1691(are)S1840(equal)S2083(to)S2186(the)S2334(salt,)S2524(and)S2694(the)S2842(rest)S3013(is)S3105(the)S3253(result)S3502(of)S3611(encrypting)S4066(the)S4214(key)S4384(and)S4554(the)S4702(salt.)S2712 V1080(If)S10 B(crypt\(\))298 1178 A10 R1506(is)S1604(called)S1876(with)S2086(a)S2162(salt)S2333(that)S2515(has)S2680(the)S2834(form)S10 B3061(##)S10 I3161(user)S10 R3365(then)S3569(the)S3723(key)S3899(is)S3997(encrypted)S4425(and)S4601(compared)S5029(to)S5138(the)S2832 V1080(encrypted)S1516(password)S1935(of)S10 I2058(user)S10 R2270(in)S2387(the)S2549(shadow)S2895(password)S3314(\256le.)S3532(If)S3639(they)S3851(are)S4014(equal)S4271(then)S10 B(crypt\(\))298 4483 A10 R4820(returns)S5138(the)S2952 V10 B1080(##)S10 I1180(user)S10 R1387(argument,)S1826(if)S1922(not)S2084(then)S2291(some)S2537(other)S2778(string)S3041(is)S3142(returned.)S3562(This)S3775(trick)S3994(assures)S4319(that)S4504(the)S4661(normal)S4980(way)S5183(to)S3072 V1080(authenticate)S1592(a)S1662(password)S(still)151 2067 A2243(works:)S3240 V1440(if)S1527(\(strcmp\(pw->pw_passwd,)S2602(crypt\(key,)S(pw->pw_passwd\)\)\))785 3038 A(...)75 3848 A3408 V1080(If)S10 I(key)135 1175 A10 R1337(is)S1431(a)S1503(null)S1687(string,)S1969(and)S2142(the)S2293(shadow)S2628(password)S3036(is)S3131(a)S3204(null)S3388(string)S3645(or)S3757(the)S3908(salt)S4076(is)S4171(a)S4244(null)S4428(string)S4685(then)S4886(the)S5037(result)S3528 V1080(equals)S10 I1369(salt)S10 R1522(.)S1604(\(This)S1849(is)S(because)319 1948 A2299(the)S2454(caller)S2711(can't)S2945(tell)S3106(if)S3200(a)S3277(password)S3689(\256eld)S3900(is)S3998(empty)S4280(in)S4389(the)S4543(shadow)S4881(password)S3648 V1080(\256le.\))S3816 V1080(The)S1262(key)S1432(and)S1602(salt)S1767(are)S1916(limited)S2226(to)S(1024)200 2329 A2554(bytes)S2791(total)S2995(including)S3399(the)S3547(null)S3728(bytes.)S3984 V9 R720(F)S722(FI)S774(IL)S807(LE)S865(ES)S923(S)S4104 V10 R(/usr/lib/pwdauth)659 1080 A2330(The)S2512(password)S2917(authentication)S3512(program)S4272 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S4392 V10 B1080(getpass)S10 R1393(\(3\),)S10 B1561(getpwent)S10 R1954(\(3\),)S10 B2122(passwd)S10 R2435(\(5\),)S10 B2603(pwdauth)S10 R2984(\(8\).)S4560 V9 R720(N)S722(NO)S790(OT)S858(TE)S916(ES)S974(S)S4680 V10 R1080(The)S1274(result)S1535(of)S1657(an)S1790(encryption)S2258(is)S2363(returned)S2737(in)S2853(a)S2936(static)S3187(array)S3433(that)S3622(is)S(overwritten)465 3727 A4230(by)S(each)185 4368 A4591(call.)S4825(The)S5020(return)S4800 V1080(value)S(should)267 1323 A1615(not)S1768(be)S1888(modi\256ed.)S4968 V9 R720(A)S722(AU)S790(UT)S858(TH)S916(HO)S984(OR)S1052(R)S5088 V10 R1080(Kees)S1307(J.)S1396(Bot)S1566(\(kjb@cs.vu.nl\))S7903 V720(Page)S941(1)S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Trailer%%DocumentFonts: Times-Roman Times-Bold Times-Italic%%Pages: 1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -