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

📄 rfc1950.ps

📁 著名的RFC文档,其中有一些文档是已经翻译成中文的的.
💻 PS
📖 第 1 页 / 共 3 页
字号:
(Format)f(Speci\256cation\272)g(by)g(L.)h(Peter)g(Deutsch.)114793 y(\(See)g(reference)g([3])g(in)e(Chapter)i(3,)f(below\))114870 y(Other)f(compressed)h(data)h(formats)f(are)h(not)e(speci\256ed)h(in)g(this)f(version)g(of)h(the)g(zlib)g(speci\256cation.)11957 y Fc(ADLER32)g(\(Adler)n(-32)h(checksum\))114 1034y Fk(This)f(contains)g(a)h(checksum)g(value)g(of)g(the)g(uncompressed)f(data)h(\(excluding)f(any)h(dictionary)f(data\))h(computed)1141090 y(according)c(to)g(Adler)o(-32)g(algorithm.)13 b(This)8b(algorithm)g(is)g(a)h(32-bit)e(extension)g(and)i(improvement)f(of)h(the)f(Fletcher)114 1147 y(algorithm,)f(used)g(in)g(the)g(ITU-T)g(X.224)g(/ISO)h(8073)e(standard.)14 b(See)8 b(references)g([4])g(and)f([5])h(in)f(Chapter)g(3,)i(below\))114 1234 y(Adler)o(-32)f(is)h(composed)g(of)g(two)f(sums)h(accumulated)g(per)h(byte:)j(s1)c(is)f(the)h(sum)g(of)h(all)f(bytes,)g(s2)f(is)h(the)g(sum)g(of)h(all)1141290 y(s1)e(values.)14 b(Both)8 b(sums)g(are)i(done)e(modulo)f(65521.)14 b(s1)8 b(is)g(initialized)f(to)h(1,)h(s2)g(to)f(zero.)15b(The)8 b(Adler)o(-32)g(checksum)114 1347 y(is)i(stored)h(as)g(s2*65536)e(+)i(s1)g(in)g(most-signi\256cant-byte)d(\256rst)j(\(network\))g(order)n(.)0 1501 y Fe(2.3)50 b(Compliance)01619 y Fk(A)9 b(compliant)g(compressor)g(must)g(produce)g(streams)g(with)f(correct)i(CMF)l(,)h(FLG)f(and)f(ADLER32,)g(but)g(need)g(not)g(support)0 1675 y(preset)g(dictionaries.)k(When)c(the)g(zlib)f(data)h(format)h(is)f(used)f(as)i(part)f(of)g(another)g(standard)f(data)h(format,)i(the)d(compressor)0 1732 y(may)j(use)e(only)g(preset)h(dictionaries)f(that)g(are)i(speci\256ed)e(by)h(this)f(other)h(data)g(format.)15 b(If)c(this)d(other)i(format)h(does)e(not)g(use)01788 y(the)i(preset)g(dictionary)e(feature,)j(the)f(compressor)g(must)g(not)f(set)h(the)g(FDICT)h(\257ag.)0 1875 y(A)h(compliant)g(decompressor)g(must)f(check)i(CMF)l(,)h(FLG,)f(and)f(ADLER32,)g(and)g(provide)g(an)g(error)h(indication)d(if)i(any)0 1932y(of)h(these)f(have)h(incorrect)f(values.)22 b(A)14 b(compliant)f(decompressor)g(must)g(give)g(an)h(error)g(indication)e(if)i(CM)g(is)f(not)g(one)0 1988 y(of)e(the)h(values)e(de\256ned)i(in)f(this)f(speci\256cation)g(\(only)h(the)g(value)g(8)h(is)f(permitted)f(in)h(this)g(version\),)g(since)g(another)g(value)0 2045 y(could)h(indicate)g(the)g(presence)h(of)f(new)h(features)g(that)f(would)f(cause)i(subsequent)e(data)h(to)g(be)h(interpreted)f(incorrectly)m(.)02101 y(A)i(compliant)e(decompressor)i(must)f(give)g(an)h(error)g(indication)e(if)h(FDICT)h(is)g(set)f(and)g(DICTID)h(is)g(not)e(the)i(identi\256er)0 2158 y(of)f(a)f(known)g(preset)g(dictionary)m(.)18b(A)12 b(decompressor)h(may)g(ignore)e(FLEVEL)h(and)h(still)d(be)j(compliant.)18 b(When)13 b(the)f(zlib)0 2214 y(data)d(format)h(is)e(being)h(used)f(as)i(a)f(part)g(of)g(another)g(standard)f(format,)j(a)e(compliant)f(decompressor)h(must)g(support)f(all)g(the)02271 y(preset)k(dictionaries)f(speci\256ed)i(by)f(the)g(other)h(format.)20 b(When)12 b(the)g(other)h(format)g(does)f(not)g(use)g(the)g(preset)h(dictionary)0 2327 y(feature,)f(a)f(compliant)g(decompressor)f(must)h(reject)h(any)f(stream)g(in)g(which)f(the)h(FDICT)h(\257ag)f(is)g(set.)0 2719 y(Deutsch)f(&)i(Gailly)612 b(Informational)g([Page)12b(6])p eop%%Page: 7 77 6 bop 0 46 a Fk(RFC)12 b(1950)374 b(ZLIB)12 b(Compressed)f(Data)g(Format)h(Speci\256cation)374 b(May)12 b(1996)0 195 yFi(3)60 b(Refer)o(ences)0 329 y Fk([1])9 b(Deutsch,)g(L.P)-5b(.,\252GZIP)10 b(Compressed)f(Data)g(Format)g(Speci\256cation\272,)h(available)e(in)h(ftp://ftp.uu.net/pu)o(b/archiv)o(ing)o(/)0385 y(zip/doc/)0 472 y([2])g(Thomas)f(Boutell,)g(\252PNG)h(\(Portable)f(Network)f(Graphics\))h(speci\256cation\272,)h(available)e(in)h(ftp://ftp.uu.net/graphics)o(/)0 529 y(png/documents/)0616 y([3])19 b(Deutsch,)g(L.P)-5 b(.,\252DEFLA)g(TE)19b(Compressed)g(Data)f(Format)h(Speci\256cation\272,)h(available)e(in)g(ftp://ftp.uu.net/pub)o(/)0 672 y(archiving/zip/doc/)0759 y([4])13 b(Fletcher)n(,)g(J.)g(G.,)h(\252An)e(Arithmetic)g(Checksum)g(for)h(Serial)g(T)n(ransmissions,\272)e(IEEE)h(T)n(ransactions)g(on)g(Communi-)0 816 y(cations,)e(V)-6b(ol.)15 b(COM-30,)d(No.)j(1,)d(January)e(1982,)h(pp.)k(247-252.)0903 y([5])g(ITU-T)g(Recommendation)g(X.224,)h(Annex)e(D,)h(\252Checksum)h(Algorithms,\272)e(November)n(,)j(1993,)e(pp.)27b(144,)15 b(145.)0 959 y(\(A)m(vailable)10 b(from)i(gopher://info.itu)o(.ch\).)h(ITU-T)e(X.244)g(is)g(also)f(the)h(same)h(as)f(ISO)h(8073.)01136 y Fi(4)60 b(Sour)o(ce)14 b(code)0 1270 y Fk(Source)9b(code)g(for)f(a)h(C)h(language)d(implementation)h(of)g(a)h(\252zlib\272)g(compliant)e(library)h(is)g(available)g(at)h(ftp://ftp.uu.net/pub)o(/)0 1326 y(archiving/zip/zlib/)o(.)01503 y Fi(5)60 b(Security)13 b(Considerations)0 1636y Fk(A)e(decoder)g(that)g(fails)g(to)f(check)i(the)f(ADLER32)f(checksum)h(value)g(may)g(be)h(subject)e(to)h(undetected)f(data)h(corruption.)0 1813 y Fi(6)60 b(Acknowledgements)0 1947y Fk(T)n(rademarks)12 b(cited)f(in)f(this)g(document)h(are)h(the)f(property)f(of)h(their)g(respective)g(owners.)0 2034y(Jean-Loup)g(Gailly)f(and)i(Mark)g(Adler)g(designed)e(the)h(zlib)h(format)g(and)f(wrote)h(the)f(related)h(software)f(described)g(in)g(this)0 2090 y(speci\256cation.)j(Glenn)d(Randers-Pehrson)g(converted)f(this)g(document)h(to)g(RFC)h(and)f(HTML)g(format.)02267 y Fi(7)60 b(Authors')15 b(Addr)o(esses)0 2401 yFk(L.)c(Peter)h(Deutsch)0 2719 y(Deutsch)e(&)i(Gailly)612b(Informational)g([Page)12 b(7])p eop%%Page: 8 88 7 bop 0 46 a Fk(RFC)12 b(1950)374 b(ZLIB)12 b(Compressed)f(Data)g(Format)h(Speci\256cation)374 b(May)12 b(1996)114 195y Fd(Aladdin)29 b(Enterprises)114 252 y(203)f(Santa)g(Margarita)i(Ave.)114 308 y(Menlo)e(Park,)h(CA)f(94025)114 421 y(Phone:)h(\(415\))f(322-0103)i(\(AM)e(only\))114 477 y(FAX:)83 b(\(415\))28b(322-1734)114 534 y(EMail:)h(<ghost@aladdin.)q(com>)0677 y Fk(Jean-Loup)10 b(Gailly)114 764 y Fd(EMail:)29b(<gzip@prep.ai.m)q(it.e)q(du>)0 851 y Fk(Questions)9b(about)i(the)f(technical)h(content)f(of)h(this)f(speci\256cation)g(can)i(be)f(sent)g(by)g(email)g(to)114 938 y Fd(Jean-Loup)29b(Gailly)g(<gzip@prep.a)q(i.mi)q(t.ed)q(u>)i(and)114995 y(Mark)d(Adler)h(<madler@alumni.)q(cal)q(tech)q(.edu)q(>)01082 y Fk(Editorial)9 b(comments)j(on)e(this)h(speci\256cation)f(can)h(be)g(sent)g(by)g(email)g(to)114 1169 y Fd(L.)27 b(Peter)i(Deutsch)g(<ghost@aladd)q(in.c)q(om>)i(and)114 1225 y(Glenn)d(Randers-Pehr)q(son)j(<randeg@alumni.)q(rpi)q(.edu)q(>)0 1402 y Fi(8)60 b(Appendix:)20b(Rationale)0 1537 y Fe(8.1)50 b(Pr)o(eset)13 b(dictionaries)01655 y Fk(A)8 b(preset)g(dictionary)f(is)g(specially)g(useful)h(to)f(compress)h(short)g(input)f(sequences.)13 b(The)8 b(compressor)g(can)h(take)f(advantage)0 1711 y(of)h(the)g(dictionary)f(context)g(to)h(encode)h(the)f(input)f(in)g(a)i(more)g(compact)f(manner)n(.)15b(The)9 b(decompressor)g(can)h(be)f(initialized)0 1768y(with)g(the)g(appropriate)g(context)g(by)h(virtually)e(decompressing)g(a)i(compressed)g(version)f(of)h(the)f(dictionary)f(without)g(pro-)01824 y(ducing)h(any)i(output.)i(However)d(for)h(certain)f(compression)g(algorithms)f(such)h(as)g(the)h(de\257ate)g(algorithm)e(this)g(operation)0 1881 y(can)i(be)h(achieved)f(without)e(actually)h(performing)h(any)g(decompression.)0 1968 y(The)i(compressor)g(and)g(the)g(decompressor)f(must)h(use)g(exactly)g(the)f(same)i(dictionary)m(.)20 b(The)13 b(dictionary)e(may)j(be)f(\256xed)0 2024y(or)h(may)g(be)g(chosen)f(among)g(a)h(certain)g(number)f(of)h(prede\256ned)g(dictionaries,)f(according)g(to)g(the)g(kind)g(of)h(input)e(data.)0 2081 y(The)f(decompressor)f(can)i(determine)f(which)f(dictionary)f(has)i(been)g(chosen)g(by)f(the)h(compressor)g(by)f(checking)h(the)f(dic-)0 2137 y(tionary)g(identi\256er)n(.)15b(This)c(document)g(does)g(not)f(specify)h(the)h(contents)e(of)h(prede\256ned)h(dictionaries,)e(since)h(the)g(optimal)02193 y(dictionaries)g(are)i(application)e(speci\256c.)19b(Standard)12 b(data)h(formats)f(using)f(this)h(feature)h(of)f(the)g(zlib)g(speci\256cation)g(must)0 2250 y(precisely)e(de\256ne)i(the)f(allowed)f(dictionaries.)0 2405 y Fe(8.2)50 b(The)13b(Adler)n(-32)e(algorithm)0 2522 y Fk(The)g(Adler)o(-32)g(algorithm)g(is)g(much)h(faster)g(than)f(the)g(CRC32)h(algorithm)f(yet)g(still)f(provides)g(an)i(extremely)g(low)f(prob-)0 2579 y(ability)f(of)h(undetected)f(errors.)0 2719 y(Deutsch)g(&)i(Gailly)612b(Informational)g([Page)12 b(8])p eop%%Page: 9 99 8 bop 0 46 a Fk(RFC)12 b(1950)374 b(ZLIB)12 b(Compressed)f(Data)g(Format)h(Speci\256cation)374 b(May)12 b(1996)0 195 y(The)f(modulo)f(on)h(unsigned)e(long)h(accumulators)h(can)g(be)g(delayed)g(for)g(5552)f(bytes,)h(so)g(the)g(modulo)f(operation)g(time)h(is)0252 y(negligible.)k(If)d(the)f(bytes)g(are)h(a,)h(b,)f(c,)g(the)f(second)g(sum)h(is)f(3a)h(+)f(2b)g(+)h(c)g(+)f(3,)h(and)g(so)f(is)g(position)e(and)j(order)g(sensitive,)0 308 y(unlike)7b(the)h(\256rst)h(sum,)g(which)f(is)g(just)f(a)i(checksum.)14b(That)8 b(65521)f(is)h(prime)h(is)f(important)f(to)h(avoid)g(a)g(possible)f(lar)o(ge)i(class)0 364 y(of)g(two-byte)f(errors)i(that)e(leave)h(the)g(check)h(unchanged.)k(\(The)9 b(Fletcher)g(checksum)g(uses)g(255,)g(which)g(is)f(not)h(prime)g(and)0 421 y(which)h(also)h(makes)h(the)e(Fletcher)i(check)f(insensitive)e(to)i(single)f(byte)g(changes)h(0)g Fg(<)p Fk(-)p Fg(>)h Fk(255.\))0 508 y(The)e(sum)h(s1)f(is)g(initialized)f(to)h(1)g(instead)g(of)g(zero)h(to)f(make)i(the)e(length)f(of)i(the)f(sequence)g(part)h(of)f(s2,)h(so)f(that)g(the)g(length)0 564 y(does)h(not)f(have)h(to)g(be)g(checked)h(separately)m(.)i(\(Any)d(sequence)g(of)g(zeroes)h(has)f(a)g(Fletcher)h(checksum)f(of)g(zero.\))0 741 y Fi(9)60 b(Appendix:)20 b(Sample)14 b(code)0875 y Fk(The)8 b(following)f(C)h(code)h(computes)f(the)g(Adler)o(-32)f(checksum)i(of)f(a)h(data)f(buf)o(fer)n(.)14 b(It)9 b(is)e(written)h(for)g(clarity)m(,)h(not)f(for)g(speed.)0 931 y(The)i(sample)g(code)h(is)f(in)f(the)h(ANSI)h(C)g(programming)f(language.)k(Non)c(C)h(users)e(may)i(\256nd)f(it)g(easier)h(to)f(read)g(with)g(these)0988 y(hints:)114 1068 y Fb(&)149 b(Bitwise)24 b(AND)h(operator.)1141118 y(>>)124 b(Bitwise)24 b(right)h(shift)f(operator.)g(When)h(applied)f(to)h(an)288 1168 y(unsigned)f(quantity,)g(as)h(here,)f(right)h(shift)f(inserts)g(zero)h(bit\(s\))288 1217 y(at)g(the)f(left.)114 1267 y(<<)124 b(Bitwise)24 b(left)h(shift)f(operator.)g(Left)h(shift)f(inserts)g(zero)288 1317 y(bit\(s\))g(at)h(the)g(right.)1141367 y(++)124 b("n++")24 b(increments)g(the)h(variable)f(n.)1141417 y(\045)149 b(modulo)24 b(operator:)g(a)h(\045)g(b)g(is)g(the)f(remainder)g(of)h(a)g(divided)f(by)h(b.)114 1516 y(#define)f(BASE)g(65521)h(/*)g(largest)f(prime)g(smaller)h(than)f(65536)g(*/)1141616 y(/*)188 1666 y(Update)h(a)g(running)f(Adler-32)g(checksum)g(with)h(the)f(bytes)h(buf[0..len-1])139 1716 y(and)f(return)h(the)f(updated)g(checksum.)g(The)h(Adler-32)f(checksum)g(should)h(be)1391765 y(initialized)e(to)i(1.)139 1865 y(Usage)f(example:)1881965 y(unsigned)h(long)f(adler)g(=)h(1L;)188 2064 y(while)g(\(read)p465 2064 13 2 v 14 w(buffer\(buffer,)f(length\))g(!=)h(EOF\))fFa(f)238 2114 y Fb(adler)h(=)f(update)p 589 2114 V 15w(adler32\(adler,)f(buffer,)i(length\);)188 2164 y Fa(g)1882214 y Fb(if)g(\(adler)f(!=)h(original)p 714 2214 V 14w(adler\))g(error\(\);)114 2264 y(*/)114 2313 y(unsigned)f(long)g(update)p 614 2313 V 15 w(adler32\(unsigned)f(long)i(adler,)1882363 y(unsigned)g(char)f(*buf,)g(int)h(len\))114 2413y Fa(f)163 2463 y Fb(unsigned)g(long)f(s1)h(=)g(adler)f(&)h(0xffff;)1632513 y(unsigned)g(long)f(s2)h(=)g(\(adler)f(>>)h(16\))f(&)h(0xffff;)1632562 y(int)g(n;)0 2719 y Fk(Deutsch)10 b(&)i(Gailly)612b(Informational)g([Page)12 b(9])p eop%%Page: 10 1010 9 bop 0 46 a Fk(RFC)12 b(1950)374 b(ZLIB)12 b(Compressed)f(Data)g(Format)h(Speci\256cation)374 b(May)12 b(1996)163 195y Fb(for)25 b(\(n)g(=)g(0;)f(n)h(<)g(len;)f(n++\))h Fa(f)213245 y Fb(s1)g(=)g(\(s1)f(+)h(buf[n]\))f(\045)h(BASE;)213295 y(s2)g(=)g(\(s2)f(+)h(s1\))124 b(\045)25 b(BASE;)163345 y Fa(g)163 394 y Fb(return)g(\(s2)f(<<)h(16\))g(+)g(s1;)114444 y Fa(g)114 544 y Fb(/*)f(Return)h(the)f(adler32)h(of)f(the)h(bytes)f(buf[0..len-1])g(*/)114 643 y(unsigned)g(long)g(adler32\(unsigned)g(char)g(*buf,)h(int)f(len\))114 693 y Fa(f)163 743 yFb(return)h(update)p 490 743 13 2 v 14 w(adler32\(1L,)f(buf,)h(len\);)114 793 y Fa(g)0 2719 y Fk(Deutsch)10 b(&)i(Gailly)601b(Informational)g([Page)11 b(10])p eop%%Trailerenduserdict /end-hook known{end-hook}if%%EOF

⌨️ 快捷键说明

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