📄 rfc2938.txt
字号:
RFC 2938 Identifying Composite Media Features September 20003.1.2 Base-32 value representation RFC 1321 [6] describes how to calculate an MD5 hash value that is a sequence of 16 octets. This is then required to be coded as a base- 32 value, which is a sequence of base-32 digit characters. Each successive character in a base-32 value represents 5 successive bits of the underlying octet sequence. Thus, each group of 8 characters represents a sequence of 5 octets (40 bits): 1 2 3 01234567 89012345 67890123 45678901 23456789 +--------+--------+--------+--------+--------+ |< 1 >< 2| >< 3 ><|.4 >< 5.|>< 6 ><.|7 >< 8 >| +--------+--------+--------+--------+--------+ <===> 8th character <====> 7th character <===> 6th character <====> 5th character <====> 4th character <===> 3rd character <====> 2nd character <===> 1st character The value (i.e. sequence of bits) represented by each base-32 digit character is indicated by the following table: "0" 0 "A" 10 "K" 20 "U" 30 "1" 1 "B" 11 "L" 21 "V" 31 "2" 2 "C" 12 "M" 22 "3" 3 "D" 13 "N" 23 "4" 4 "E" 14 "O" 24 "5" 5 "F" 15 "P" 25 "6" 6 "G" 16 "Q" 26 "7" 7 "H" 17 "R" 27 "8" 8 "I" 18 "S" 28 "9" 9 "J" 19 "T" 29 When encoding a base-32 value, each full group of 5 octets is represented by a sequence of 8 characters indicated above. If a group of less than 5 octets remain after this, they are encoded using as many additional characters as may be needed: 1, 2, 3 or 4 octets are encoded by 2, 4, 5 or 7 characters respectively. Any spare bits represented by the base-32 digit characters are selected to be zero.Klyne & Masinter Standards Track [Page 7]RFC 2938 Identifying Composite Media Features September 2000 When decoding a base-32 value, the reverse mapping is applied: each full group of 8 characters codes a sequence of 5 octets. A final group of 2, 4, 5 or 7 characters codes a sequence of 1, 2, 3 or 4 octets respectively. Any spare bits represented by the final group of characters are discarded. Thus, for a 128-bit (16 octet) MD5 hash value, the first 15 octets are coded as 24 base 32 digit characters, and the final octet is coded by two characters. NOTE: Base64 representation (per MIME [4]) would be more compact (21 rather than 26 characters for the MD5 128-bit hash value), but an auxiliary predicate name is defined (by [1]) to have the same syntax as a feature tag, and the feature tag matching rules (per [2]) state that feature tag matching is case insensitive. Base36 representation was considered (i.e., using all letters "A"-"Z") but was not used because this would require extended precision multiplication and division operations to encode and decode the hash values.3.2 Resolving feature set identifiers This memo does not mandate any particular mechanism for dereferencing a feature set identifier. It is expected that specific dereferencing mechanisms will be specified for any application or protocol that uses them. The following sections describe some ways that feature set dereferencing information may be incorporated into a feature set expression. These are based on auxiliary predicate definitions within a "where" clause [1]. When a hashed feature set reference is used, conformance to the hashing rules takes precedence over any other determination of the feature expression. Any expression, however obtained, may not be substituted for the hash-based reference unless it yields the correct hash value.3.2.1 Query protocol A protocol providing request/response type queries (e.g., HTTP, LDAP, etc.) might be set up to provide a resolution service. Thus, a query to a server associated with the capabilities could be performed on the feature set identifier. The response returned would be a CONNEG expression; e.g.,Klyne & Masinter Standards Track [Page 8]RFC 2938 Identifying Composite Media Features September 2000 (h.SBB5REAOMHC09CP2GM4V07PQP0) where (h.SBB5REAOMHC09CP2GM4V07PQP0) :- (& (pix-x<=200) (pix-y<=150) ) end or just: (& (pix-x<=200) (pix-y<=150) ) This result would be combined with the original expression to obtain a result not including the hash based predicate. This process might be further enhanced by using URN resolution mechanisms (e.g., DNS NAPTR [10]) to discover the resolution protocol and server.3.2.2 Inline feature set details In this case, a reference is resolved by including its definition inline in an expression. The feature set expression associated with a reference value may be specified directly in a "where" clause, using the auxiliary predicate definition syntax [1]; e.g., (& (dpi=100) (h.SBB5REAOMHC09CP2GM4V07PQP0) ) where (h.SBB5REAOMHC09CP2GM4V07PQP0) :- (& (pix-x<=200) (pix-y<=150) ) end This form might be used on request (where the request mechanism is defined by the invoking application protocol), or when the originator believes the recipient may not understand the reference. It is an error if the inline feature expression does not yield the hash value contained in auxiliary predicate name. NOTE: viewed in isolation, this format does not have any obvious value, in that the (h.xxx) form of auxiliary predicate could be replaced by any arbitrary name. It is anticipated that this form might be used as a follow-up response in a sequence along the lines of: A> Capabilities are: (& (dpi=100) (h.SBB5REAOMHC09CP2GM4V07PQP0) ) B> Do not understand: (h.SBB5REAOMHC09CP2GM4V07PQP0)Klyne & Masinter Standards Track [Page 9]RFC 2938 Identifying Composite Media Features September 2000 A> Capabilities are: (& (dpi=100) (h.SBB5REAOMHC09CP2GM4V07PQP0) ) where (h.SBB5REAOMHC09CP2GM4V07PQP0) :- (& (pix-x<=200) (pix-y<=150) ) end4. Examples The following are some examples of feature set expressions containing feature set references: (& (dpi=100) (h.SBB5REAOMHC09CP2GM4V07PQP0) ) (& (dpi=100) (h.SBB5REAOMHC09CP2GM4V07PQP0) ) where (h.SBB5REAOMHC09CP2GM4V07PQP0) :- (& (pix-x<=200) (pix-y<=150) ) end (h.QGEOPMCF02P09QC016CEPU22FO) where (h.QGEOPMCF02P09QC016CEPU22FO) :- (| (& (ua-media=continuous) (dpi=200) (dpi-xyratio=200/100) (color=Binary) (paper-size=B4) (image-coding=MH) ) (& (ua-media=continuous) (dpi=200) (dpi-xyratio=200/100) (color=Binary) (paper-size=B4) (image-coding=MR) ) (& (ua-media=stationery) (dpi=300) (dpi-xyratio=1) (color=Binary) (paper-size=A4) (image-coding=JBIG) ) (& (ua-media=transparency) (dpi=300) (dpi-xyratio=1) (color=Binary) (paper-size=A4) (image-coding=JBIG) ) ) end The following examples are based on Internet fax work, and show how a feature-hash might be used to express the commonly-used features. A form of Internet fax system that is expected to be quite common is a so-called "simple mode" system, whose capabilities are described by the following feature expression: (& (image-file-structure=TIFF-minimal) (MRC-mode=0) (color=Binary) (image-coding=MH) (MRC-mode=0) (| (& (dpi=204) (dpi-xyratio=[204/98,204/196]) ) (& (dpi=200) (dpi-xyratio=[200/100,1]) ) ) (size-x<=2150/254) (paper-size=A4)Klyne & Masinter Standards Track [Page 10]RFC 2938 Identifying Composite Media Features September 2000 (ua-media=stationery) ) This might be expressed by the hash-based feature set identifier: (h.MSB955PVIRT1QOHET9AJT5JM3O) The following example describes capabilities of a full-color Internet fax system. Note a number of feature values are applicable in common with '(color=grey)' and '(color=full)': (& (image-file-structure=TIFF) (MRC-mode=0) (| (& (color=Binary) (image-coding=[MH,MR,MMR]) (| (& (dpi=204) (dpi-xyratio=[204/98,204/196]) ) (& (dpi=200) (dpi-xyratio=[200/100,1]) ) (& (dpi=300) (dpi-xyratio=1) ) ) ) (& (color=grey) (image-coding=JPEG) (image-coding-constraint=JPEG-T4E) (color-levels<=256) (color-space=CIELAB) (color-illuminant=D50) (CIELAB-L-min>=0) (CIELAB-L-max<=100) (dpi=[100,200,300]) (dpi-xyratio=1) ) (& (color=full) (image-coding=JPEG) (image-coding-constraint=JPEG-T4E) (color-subsampling=["1:1:1","4:1:1"]) (color-levels<=16777216) (color-space=CIELAB) (color-illuminant=D50) (CIELAB-L-min>=0) (CIELAB-L-max<=100) (CIELAB-a-min>=-85) (CIELAB-a-max<=85) (CIELAB-b-min>=-75) (CIELAB-b-max<=125) (dpi=[100,200,300]) (dpi-xyratio=1) ) ) (size-x<=2150/254) (paper-size=[letter,A4,B4]) ) (ua-media=stationery) )Klyne & Masinter Standards Track [Page 11]RFC 2938 Identifying Composite Media Features September 2000 Separating out the common capabilities yields: (& (image-file-structure=TIFF) (MRC-mode=0) (| (& (color=Binary) (image-coding=[MH,MR,MMR]) (| (& (dpi=204) (dpi-xyratio=[204/98,204/196]) ) (& (dpi=200) (dpi-xyratio=[200/100,1]) ) (& (dpi=300) (dpi-xyratio=1) ) ) ) (& (color=grey) (color-levels<=256) (h.QVSEM8V2LMJ8VOR7V682J7079O) ) (& (color=full) (color-subsampling=["1:1:1","4:1:1"]) (color-levels<=16777216) (CIELAB-a-min>=-85) (CIELAB-a-max<=85) (CIELAB-b-min>=-75) (CIELAB-b-max<=125) (h.QVSEM8V2LMJ8VOR7V682J7079O) ) ) (size-x<=2150/254) (paper-size=[letter,A4,B4]) ) (ua-media=stationery) ) where (h.QVSEM8V2LMJ8VOR7V682J7079O) :- (& (image-coding=JPEG) (image-coding-constraint=JPEG-T4E) (color-space=CIELAB) (color-illuminant=D50) (CIELAB-L-min>=0) (CIELAB-L-max<=100) (dpi=[100,200,300]) (dpi-xyratio=1) ) end5. Internationalization Considerations Feature set expressions and URI strings are currently defined to consist of only characters from the US-ASCII repertoire [1,5]; under these circumstances this specification is not impacted by internationalization considerations (other than any already applicable to URIs [5]). But, if future revisions of the feature set syntax permit non-US- ASCII characters (e.g. within quoted strings), then some canonical representation must be defined for the purposes of calculating hash values. One choice might be to use a UTF-8 equivalent representation as the basis for calculating the feature set hash. Another choiceKlyne & Masinter Standards Track [Page 12]RFC 2938 Identifying Composite Media Features September 2000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -