Show the on-the-wire representation of employee1 from the previous… Show the on-the-wire representation of employee1 from the previous problemthat is generated by XDR.3 For the data structures given in Exercise 1, give the XDR routine that encodes/decodes these structures. If you have XDR available to you, run this routine andmeasure how long it takes to encode and decode an example instance of structureemployee.4 Using library functions like htonl and Unix’s bcopy or Windows’ CopyMemory,implement a routine that generates the same on-the-wire representation of thestructures given in Exercise 1 as XDR does. If possible, compare the performanceof your “by-hand” encoder/decoder with the corresponding XDR routines.5 Use XDR and htonl to encode a 1000-element array of integers. Measure andcompare the performance of each. How do these compare to a simple loop thatreads and writes a 1000-element array of integers? Perform the experiment on acomputer for which the native byte order is the same as the network byte order,as well as on a computer for which the native byte order and the network byte order are different.6 Write your own implementation of htonl. Using both your own htonl and (iflittle-endian hardware is available) the standard library version, run appropriateexperiments to determine how much longer it takes to byte-swap integers versusmerely copying them.572 7 End-to-End Data7 Give the ASN.1 encoding for the following three integers. Note that ASN.1 integers, like those in XDR, are 32 bits in length.(a) 101(b) 10,120(c) 16,909,0608 Give the ASN.1 encoding for the following three integers. Note that ASN.1 integers, like those in XDR, are 32 bits in length.(a) 15(b) 29,496,729(c) 58,993,4589 Give the big-endian and little-endian representation for the integers fromExercise 7.10 Give the big-endian and little-endian representation for the integers fromExercise 8.11 XDR is used to encode/decode the header for the SunRPC protocol illustratedby Figure 5.20. The XDR version is determined by the RPCVersion field. Whatpotential difficulty does this present? Would it be possible for a new version ofXDR to switch to little-endian integer format?12 The presentation formatting process is sometimes regarded as an autonomousprotocol layer, separate from the application. If this is so, why might includingdata compression in the presentation layer be a bad idea?13 Suppose you have a machine with a 36-bit word size. Strings are represented asfive packed 7-bit characters per word. What presentation issues on this machinehave to be addressed for it to exchange integer and string data with the rest of theworld?14 Using the programming language of your choice that supports user-defined automatic type conversions, define a type netint and supply conversions that enable assignments and equality comparisons between ints and netints. Can a generalization of this approach solve the problem of network argumentmarshalling?Exercises 57315 Different architectures have different conventions on bit order as well as byteorderwhether the least significant bit of a byte, for example, is bit 0 or bit 7.[Pos81] defines (in its Appendix B) the standard network bit order. Why is bitorder then not relevant to presentation formatting?16 Let p = 1 be the fraction of machines in a network that are big-endian; the remaining 1 – p fraction are little-endian. Suppose we choose two machines at randomand send an int from one to the other. Give the average number of byte-order conversions needed for both big-endian network byte order and receiver-makes-right,for p = 0.1, p = 0.5, and p = 0.9. Hint: The probability that both endpoints arebig-endian is p2; the probability that the two endpoints use different byte ordersis 2p(1 – p).17 Experiment with a compression utility (e.g., compress, gzip, or pkzip). What compression ratios are you able to achieve? See if you can generate data files for whichyou can achieve 5:1 or 10:1 compression ratios.18 Suppose a file contains the letters a, b, c, and d. Nominally, we require 2 bits perletter to store such a file.(a) Assume the letter a occurs 50% of the time, b occurs 30% of the time, andc and d each occur 10% of the time. Give an encoding of each letter as a bitstring that provides optimal compression. Hint: Use a single bit for a.(b) What is the percentage of compression you achieve above? (This is the average of the compression percentages achieved for each letter, weighted by theletter’s frequency.)(c) Repeat this, assuming a and b each occur 40% of the time, c occurs 15% ofthe time, and d occurs 5% of the time.19 Suppose we have a compression function c, which takes a bit string s to a compressed string c(s).(a) Show that for any integer N there must be a string s of length N for whichlength(c(s)) = N; that is, no effective compression is done.(b) Compress some already compressed files (try compressing with the same utilityseveral times in sequence). What happens to the file size?(c) Given a compression function c as in (a), give a function c’such that for all bitstrings s, length(c'(s)) = min(length(c(s)), length(s)) + 1; that is, in the worstcase, compression with c’expands the size by only 1 bit. [09/07, 11:50 am] +254 720 476419: 0 Give an algorithm for run length encoding that requires only a single byte torepresent nonrepeated symbols.21 Write a program to construct a dictionary of all “words,” defined to be runs ofconsecutive nonwhitespace, in a given text file. We might then compress the file(ignoring the loss of whitespace information) by representing each word as an index in the dictionary. Retrieve the file rfc791.txt containing [Pos81], and run yourprogram on it. Give the size of the compressed file assuming first that each wordis encoded with 12 bits (this should be sufficient), and then that the 128 mostcommon words are encoded with 8 bits and the rest with 13 bits. Assume that thedictionary itself can be stored by using, for each word, length(word) + 1 bytes.22 The one-dimensional discrete cosine transform is similar to the two-dimensionaltransform, except that we drop the second variable ( j or y) and the second cosinefactor. We also drop, from the inverse DCT only, the leading 1/v2N coefficient.Implement this and its inverse for N = 8 (a spreadsheet will do, although a language supporting matrices might be better) and answer the following:(a) If the input data is 1, 2, 3, 5, 5, 3, 2, 1, which DCT coefficients are near 0?(b) If the data is 1, 2, 3, 4, 5, 6, 7, 8, how many DCT coefficients must we keepso that after the inverse DCT the values are all within 1% of their originalvalues? 10%? Assume dropped DCT coefficients are replaced with 0s.(c) Let si, for 1 = i = 8, be the input sequence consisting of a 1 in position i and0 in position j, j = i. Suppose we apply the DCT to si, zero the last threecoefficients, and then apply the inverse DCT. Which i, 1 = i = 8, results inthe smallest error in the ith place in the result? The largest error?23 Compare the size of an all-white image in JPEG format with a “typical” photographic image of the same dimensions. At what stage or stages of the JPEGcompression process does the white image become smaller than the photographicimage?For the next three exercises, the utilities cjpeg and djpeg may be useful and can beobtained from ftp.uu.net/graphics/jpeg. Other JPEG conversion utilities can also beused. For manual creation and examination of graphics files, the pgm portable grayscale format is recommended; see the Unix pgm(5)/ppm(5) man pages.24 Create a grayscale image consisting of an 8 × 8 grid with a vertical black line inthe first column. Compress into JPEG format and decompress. How far off arethe resultant bytes at the default quality setting? How would you describe theExercises 575inaccuracies introduced, visually? What quality setting is sufficient to recover thefile exactly?25 Create an 8 × 8 grayscale image consisting of a 64-character ASCII text string.Use lowercase letters only, with no whitespace or punctuation. Compress intoJPEG format and decompress. How recognizable is the result, as text? Why mightadding whitespace make things worse? With the quality setting at 100, would thisbe a plausible way of compressing text?26 Write a program that implements forward and backward DCT, using floatingpoint arithmetic. Run the program on a sample grayscale image. Since DCT islossless, the image output by the program should match the input. Now modifyyour program so that it zeroes some of the higher-frequency components and seehow the output image is affected. How is this different from what JPEG does?27 Express DCT(0,0) in terms of the average of the pixel(x, y)s.28 Think about what functions might reasonably be expected from a video standard:fast-forward, editing capabilities, random access, and so on. (See the paper byLe Gall, “MPEG: A video compression standard for multimedia applications,”given in this chapter’s “Further Reading” section, for further ideas.) ExplainMPEG’s design in terms of these features.29 Suppose you want to implement fast-forward and reverse for MPEG streams. Whatproblems do you run into if you limit your mechanism to displaying I framesonly? If you don’t, then to display a given frame in the fast-forward sequence,what is the largest number of frames in the original sequence you may have todecode?30 Use mpeg play to play an MPEG-encoded video. Experiment with options, particularly -nob and -nop, which are used to omit the B and P frames, respectively,from the stream. What are the visible effects of omitting these frames?[09/07, 11:55 am] +254 720 476419: 1 Find an encryption utility (e.g., the Unix des command or pgp) on your system.Read its documentation and experiment with it. Measure how fast it is able toencrypt and decrypt data. Are these two rates the same? Try to compare thesetiming results using different key sizes; for example, compare single-DES withtriple-DES.2 Section 8.1.2 gives the DES encryption transformation from Li-1, Ri-1 at roundi – 1 to Li, Ri at round i. Give the reverse, that is, express Li-1, Ri-1 in termsof Li, Ri.3 Suppose that at round i in DES, Li-1 is all 0s, Ri-1 is (in hex) deadbeef, and Kiis a5bd96 860841. Give Ri, assuming that we use a simplified S box that reduceseach 6-bit chunk to 4 bits by dropping the first and last bits.4 Perform round i + 1 of DES encryption, using the result of the previous exerciseto fill in Li and Ri, and let Ki+1 be 5af310 7a3fff. Give Ri+1, assuming that we usea simplified S box that reduces each 6-bit chunk to 4 bits by dropping the first andlast bits.626 8 Network Security5 Again suppose DES used the simplified S box of the previous two exercises, andalso assume we perform only a single round of encryption.(a) Suppose an attacker has both the plaintextL0, R0 and the ciphertextL1, R1.How much does this tell the attacker about the key K1? How about K? (This isnot intended to suggest a weakness in the real DES, but rather as a justificationfor the S box DES actually uses.)(b) Being able to recover the key given a plaintext and ciphertext would be badenough for any encryption mechanism; explain why it would be particularlyfatal for public key cryptosystems.6 Suppose you are doing RSA encryption with p = 101, q = 113, and e = 3. (a) Find the decryption exponent d. (Hint: Although there are methodical waysto do this, trial and error is efficient for e = 3.)(b) Encrypt the message m = 9876. Note that evaluating m3 with 32-bit arithmeticresults in overflow.7 Suppose you are doing RSA encryption with p = 13, q = 7, and e = 5.(a) Find the decryption exponent d. (Hint: Use the Euclidean dividing algorithm.)(b) Encrypt the message m = 7.(c) Decrypt the cypher c = 2.8 Prove that the RSA decryption algorithm recovers the original message; that is,med = m mod pq. Hint: You may assume that, because p and q are relativelyprime, it suffices to prove the congruence mod p and mod q.9 If n is a prime number and b < n, then bn-1 = 1 mod n. There are a few compositen (e.g., 561) for which this congruence also holds for all b < n, but by adding alittle extra bookkeeping to the calculation we get Miller's test, which if n is primesucceeds for all b < n and if n is composite always fails for (here we need the extrabookkeeping) at least three-quarters of all b < n. If we try the test with a largenumber of b < n chosen at random, and it does not fail for any of them, then n is"probably" prime.(a) Show that calculating bn-1 mod n can be done with O(log n) multiplications.Hint: b13 = b8b4b.(b) Show, using this method, that n = 50,621 is composite. Use b = 2. You willnot need the "extra bookkeeping"; just show bn-1 = 1 mod n.Exercises 627(c) Show 2280 = 1 mod 561 (and hence automatically 2560 = (2280)2 = 1), butthat 2140 = ±1 mod 561. This last fact makes the full Miller's test fail, showing561(=3×11×17) is composite, even though the simpler bn-1 = 1 mod n testsucceeds.10 In the three-way authentication handshake of Figure 8.9, why is the server unsureof the client's identity until it receives the third message? To what attack mighta server be exposed if it trusted the client's identity before the third message wasreceived?11 Suppose the values x and y used in the three-way handshake of Figure 8.9 wereclock driven rather than random; for example, x and y were incremented once persecond or per connection.(a) Show that the technique used in the IP spoofing attack outlined in Exercise 19of Chapter 5 fails.(b) Suppose in addition an attacker could eavesdrop on the connection and knowpast transmissions from the client. Would this help the attacker?(c) Suppose that furthermore the attacker could reset the clock on the server host,perhaps using the Network Time Protocol. Show how an attacker could nowauthenticate itself to the server without knowing CHK (although it could notdecrypt SK).12 Figure 8.7 shows CBC encryption. Give the corresponding diagram for decryption.13 Figure 8.11 shows one-way authentication using RSA. Show how RSA can beused for two-way authentication.14 Learn about a key escrow encryption scheme (for example, Clipper). What are thepros and cons of key escrow?15 One mechanism for resisting "replay" attacks in password authentication is to useone-time passwords: A list of passwords is prepared, and once password[N] hasbeen accepted, the server decrements N and prompts for password[N - 1] nexttime. At N = 0 a new list is needed. Outline a mechanism by which the user andserver need only remember one master password mp and have available locally away to compute password[N] = f(mp, N). Hint: Let g be an appropriate one-wayfunction (e.g., MD5) and let password[N] = gN(mp) = g, applied N times to mp.Explain why knowing password[N] doesn't help reveal password[N - 1].628 8 Network Security16 Suppose a user employs one-time passwords as above (or, for that matter, reusablepasswords), but that the password is transmitted "sufficiently slowly."(a) Show that an eavesdropper can gain access to the remote server with a relatively modest number of guesses. Hint: The eavesdropper starts guessing afterthe original user has typed all but one character of the password.(b) To what other attacks might a user of one-time passwords be subject?17 The Diffie-Hellman key exchange protocol is vulnerable to a "man-in-the-middle"attack. Explain how an adversary sitting between two participants can trick theminto thinking they have established a shared secret between themselves, when infact they have each established a secret with the adversary. Outline how DiffieHellman can be extended to protect against this possibility.18 Suppose that RSA is used to send a message m to three recipients, who have relatively prime encryption moduli n1, n2, and n3. All three recipients use the sameencryption exponent e = 3, a once-popular choice as it makes encryption veryfast. Show that someone who intercepts all three encrypted messages c1 = m3mod n1, c2 = m3 mod n2, and c3 = m3 mod n1 can efficiently decipher m. Hint:The Chinese remainder theorem implies that you can efficiently find a c such thatc = c1 mod n1, c = c2 mod n2, and c = c3 mod n3. Assume this, and show that itimplies c = m3 mod n1n2n3. Then note m3 < n1n2n3.19 Suppose we have a very short secret s (e.g., a single bit or even a Social Securitynumber), and we wish to send someone else a message m now that will not reveal sbut that can be used later to verify that we did know s. Explain why m = MD5(s)or m = E(s) with RSA encryption would not be secure choices, and suggest abetter choice.20 Suppose two people want to play poker over the network. To "deal" the cardsthey need a mechanism for fairly choosing a random number x between them;each party stands to lose if the other party can unfairly influence the choice of x.Describe such a mechanism. Hint: You may assume that if either of two bit stringsx1 and x2 are random, then the exclusive-OR x = x1 ? x2 is random.21 Estimate the probabilities of finding two messages with the same MD5 checksum,given total numbers of messages of 263, 264, and 265. Hint: This is the birthdayproblem again, as in Exercise 49 of Chapter 2, and again the probability that thek+ 1th message has a different checksum from each of the preceding kis 1-k/2128.Exercises 629However, the approximation in the hint there for simplifying the product failsrather badly now. So, instead, take the log of each side and use the approximationlog(1 - k/2128) -k/2128.22 Suppose we wanted to encrypt a Telnet session with, say, DES. Telnet sends lots of1-byte messages, while DES encrypts in blocks of 8 bytes at a time. Explain howDES might be used securely in this setting.23 Consider the following simple UDP protocol (based loosely on TFTP, Request forComments 1350) for downloading files:¦ Client sends a file request.¦ Server replies with first data packet.¦ Client sends ACK, and the two proceed using stop-and-wait.Suppose client and server possess keys KC and KS, respectively, and that thesekeys are known to each other.(a) Extend the file downloading protocol, using these keys and MD5, to providesender authentication and message integrity. Your protocol should also beresistant to replay attacks.(b) How does the extra information in your revised protocol protect againstarrival of late packets from prior connection incarnations, and sequence number wraparound?24 Using the browser of your choice, find out what certification authorities for HTTPSyour browser is configured by default to trust. Do you trust these agencies? Findout what happens when you disable trust of some or all of these certificationauthorities.25 Suppose you want your filter-based firewall to block all incoming Telnet connections, but to allow outbound Telnet connections. One approach would be to blockall inbound packets to the designated Telnet port (23).(a) We might want to block inbound packets to other ports as well, but whatinbound TCP connections must be permitted in order not to interfere with outbound Telnet?Computer Science Engineering & Technology Networking PSYCH 309
You will get a plagiarism-free paper and you can get an originality report upon request.
All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more