
Appendix A 7-bit ASCII code 000 001 010 011 100 101 110 111 0000 nul soh stx etx eat enq ack bel 0001 bs ht nl vt np cr so si 0010 dIe del de2 dc3 dc4 nak syn etb VVll can em SUD esc LS gs rs us , 0100 space ! " # $ % & 0101 () * + , - / 0110 0 1 2 3 4 5 6 7 0111 8 9 : ; < = > ? 1000 @ A B C 0 E F G 1001 HI J KLM N 0 1010 P Q R S T U V W A - 1011 XYZ [ \ ] , -- 1100 a b c d e f g 1101 h i j k 1 ill n 0 1110 P q r s t u v w -- 1111 x y z { I ) del Row numbers represent the 4-bit prefix, and the column numbers represent the 3-bit suf­ fix. The first 32 ASCII codes and the last ASCII code are control codes, whIch are not displayable. Appendix B SMA-512 Constants (in hexadecimal) i Ki i Ki i Ki 0 428a2f98d728ae22 1 7137449123ef65cd 2 b5cOfbcfec4d3b2f ':l ,~Q1 o o--u-a-, A -v rv c v- _0C r-'~Qh~-'Q r:; ~Qf'11 f'1hhn~r1n1Q 6 923f82a4afl94f9b 7 ablc5ed5da6d8118 8 d807aa98a3030242 9 12835b0145706fbe 10 243185be4ee4b28c 11 550c7dc3d5ffb4e2 12 72be5d74f27b896f 13 80deblfe3b1696bl 14 9bdc06a725c71235 15 c19bfl74cf692694 16 e49b69c1gef14ad2 17 efbe4786384f25e3 18 Ofc19dc68b8cd5b5 19 240calcc77ac9c65 20 2de92c6f592b0275 21 4a7484aa6ea6e483 22 5cbOa9dcbd41fbd4 23 76f988da831153b5 24 983e5152ee66dfab 25 a831c66d2db43210 26 b00327c898fb213f 27 bf597fc7beefOee4 28 c6eOObf33da88fc2 29 d5a7914793 Oaa 725 30 06ca6351e003826f 31 142929670aOe6e70 32 27b70a8546d22ffc 33 2elb21385c26c926 34 4d2c6dfc5ac42aed 35 53380d139d95b3df 36 650a73548baf63de 37 766aOabb3c77b2a8 38 81c2c92e47edaee6 39 92 722c851482353b 40 a2bfe8a14cfl 0364 41 a81a664bbc423001 42 c24b8b70dOf89791 43 c76c5la30654be30 44 d192e819d6ef5218 45 d69906245565a910 46 f40e35855771202a 47 106aa07032bbdlb8 48 19a4cl16b8d2dOc8 49 le376c085141ab53 50 2748774cdf8eeb9 9 51 34bObcb5e19b48a8 52 391cOcb3c5c95a63 53 4ed8aa4ae3418acb 54 5b9cca4f7763e373 55 682e6ff3d6b2b8a3 56 748f82ee5defb2fc 57 78a5636f43172f60 58 84c87814alfOab72 59 8cc702081a643gec 60 90befffa23631e28 61 a4506cebde82bde9 62 bef9a3f7b2c67915 63 c67178f2e372532b 64 ca273eceea26619c 65 d186b8c721cOc207 66 eada7dd6cdeOeble 67 f57d4f7fee6ed178 68 06f067aa72176fba 69 Oa637dc5a2c898a6 70 113f9804bef90dae 71 Ib710b35131c471b 72 28db77f523047d84 73 32caab7b40c72493 74 3cgebeOa15c9bebc 75 431d67c49cl00d4c 76 4cc5d4becb3e42b6 77 597f299cfc657e2a 78 5fcb6fab3ad6faec 79 6c44198c4a475817 Appendix C Data Compression using ZIP ZIP is a simple matching algorithm using two sliding windows, called the base win­ dow and the look-ahead window. These two windows are placed side-by-side on the data file, where the look-ahead window goes ahead of the base window. ZIP scans the entIre file by slIdmg these two wmdows and encodmg data on the fly. In par­ tIcular, ZIP finds the longest prefix s of the data stnng contamed in the look-ahead window that also appears in the base window. This string in the look-ahead window (if found) is a copy of s in the base window, and so it can be uniquely identified by two attributes: (1) the distance between the location of the first character of s in the base wmdow and the locatIOn of the first character m the look-ahead wmdow and (2) the length of s. If the space needed to hold the values of these two attnbutes IS smaller than the space needed to hold s, we obtam a savmg of space. To implement this idea, we will need to distinguish the binary values of the two attributes from normal encodings of characters. Suppose the data file is encoded usmg the 8-blt ASCII code set. If the first bIt IS used as a panty bIt, then It could be eIther 0 or 1. The first bIt of the bmary strmg representmg the two attnbutes can also be eIther 0 or 1. Thus, to make a dlstmctIon, we add an extra bIt of 1 m front of each ASCII code to yield a 9-bit extended ASCII code and add an extra bit of 0 in front of the binary string representing the two attributes. This simple encoding uniquely identifies the original data file. In partIcular, let W1 denote the number of characters the base wmdow can hold, d d where 2 -1 < Wj < 2 for some d > 1. Let W2 denote the number of characters the 1 look-ahead window can hold, where 21- < W2 ::; 2/ for some l with 1 ::; l::; d. This produces a (d + l + 1)-bit binary encoding for s, where the first bit is 0 (used as an indicator), the next d bits represent the distance, and the last l bits represent the length. For convenience, we will call this (d + l + 1)-bit code a location code. A locatIOn code IS easIly dlstmgUlshable from any 9-blt extended ASCII code because a locatIOn code has a fixed length and an mdlcator 0 dIfferent from the indicator in a 9-bit extended ASCII code. In other words, given a compressed file using this encoding method, it can be uniquely and easily "uncompressed" back to its original ASCII format. The proof is left to the reader (see the Exercise). Thus, as long as d +l+ 1 < 8k, where k = lsi, ZIP may save space. ZIP then shifts both of the 354 C Data Compression using ZIP base window and the look-ahead window to the right max{I,k} times and repeats the same procedure until the look-ahead window is shifted out of the data file. For example, let WI = 18 and Wz = 7. Then d = 5 and I = 3. Let us consider the following text string: "a loop containing a loop is a nested loop" Denote by nb, the binary representation of positive integer n. Running ZIP on this character string produces the following output (see Fig. C.l ): where each letter and space in the output string is encoded by a 9-bit extended ASCII code. For clarity, we do not spell out the location code in binary. The length of the "compressed" string in binary is therefore equal to 18 x 9 + 9 + 11 x 9 + 9 = 279 bIts, and the length of the ongmal character stnng encoded m the 8-blt ASCII code set IS equal to 41 x 8 = 328 bIts. Thus, ZIP has compressed the ongmal data stnng to a shorter bmary string, base window look-ahead input a loop containing a loop is a nested loop 7 11 basewindQw a loop containing a loop is a nested 16 output a loop containing 017b7b is a nested 016b5" Fig. C.I A demonstration of a ZIP process To decode a compressed file, ZIP scans It from the begmnIng, removes the lead­ mg 1 from each 9-blt extended code, and replaces each 9-blt code WIth leadmg 0 by the correspondmg character substrmg using the dIstance and length attnbutes. Exercise Show why the IO-bit code defined in Section C is easily distinguishable from the extended 9-bit ASCII code. That is, given a compressed file using this encoding method, show it can be uniquely and easily "uncompressed" back to its original ASCII format AppendixD Base64 Encoding Base64 encoding represents a 6-bit binary string using a printable character (see Table D.l), where a 6-bit value of 0 to 25 represents a upper-case letter A to Z correspondingly; a 6-bit value of 26 to 51 represents a lower-case letter a to z cor­ respondingly; a 6-bit value of 52 to 61 represents a digit 0 to 9 correspondingly; and the last two 6-bit values of 62 and 63 represent H+" and HI" respectively. Trans­ mitted in ASCII format, this means that every 6-bit string is replaced with an 8-bit string. Table D.I Base64 encoding 6-bitvalue 0 I 2 3 4 5 6 7 8 9 10 II 12 13 14 15 16 17 18 19 character encoding ABC DEFGHI J KLMN 0 P Q RST 6-bit value 20 21 22 23 24 25 26 27 28 29 31 31 32 33 34 35 36 37 38 39 character encoding U V W Z Y Z abc d e f g h i j k I ill n 6-bit value 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 character encoding 0 p q r stu v w z y z 0 I 2 3 4 5 6 7 6-bit value 60 61 62 63 character encoding 8 9 + / In addition, Base64 encoding uses character "-" as a special indicator. Using Base64 encoding, a binary string is converted to a character string as follows: Case I: The binary data consists of only one byte. Pad it at the end with 16 O's to extend it to a 24-bit string. This 24-bit string is then converted to a Base64 string of four characters, wIth "==" beIng the last two characters. ThIS IndIcates that only the first two characters are to be decoded, and the suffix 0000 IS dIscarded. Case 2: The binary data consists of only two bytes. Pad it at the end with eight O's to extend it to a 24-bit string. This 24-bit string is then converted to a Base64 string of four characters, with "=" being the last character. This indicates that only the first three characters are to be decoded, and the suffix 00 IS dIscarded. Case 3: The bInary data consists of at least three bytes. Place the first three bytes of the binary data into a 24-bit buffer, where the first byte is placed in the most significant eight bits of the buffer, the second byte is placed in the middle, and the 356 D Base64 Encoding third byte in the least significant eight bits.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages32 Page
-
File Size-