Answered You can buy a ready-made answer or pick a professional tutor to order an original one.
is to write a program that calculates the Secure Hash Algorithm (SHA) digest for many files. This is mostly an I/O bound program that is, it spends a lot of time to read in data from hard drive or act
is to write a program that calculates the Secure Hash Algorithm (SHA) digest for many files. This is mostly an I/O bound program that is, it spends a lot of time to read in data from hard drive or actually wait for that data since hard drive is slow compared to cpu. This is characteristic of a lot of network programs; they tend to execute faster than the network can supply input. Consequently, they spend a lot of time blocked. This is time that other threads can use, either to process other input sources or to do something that doesn’t rely on slow input. Your assignment can be broken in two phases:
a) You write a simple program with a single class that reads at least two file (more than one file) and calculates the SHA digest for each file. Then, it prints out the result (digest for each file) on the screen as the following:
annaresume.doc: -16 -110 38 30 -30 -128 -24 68 -101 -97 -113 -109 -27 0 76 -7 126 46 -92 16 sc190.doc: -40 52 65 77 78 116 -54 109 60 -127 -62 67 58 80 -83 5 -35 -1 -78 -40
b) You modify the program such that it uses threads. The idea is to assign a separate thread to process each individual input file.
An example code segment for using a DigestInputStream is shown below (it assumes that an in input file stream (FileInputStream) is already created):
MessageDigest sha = MessageDigest.getInstance("SHA");
DigestInputStream din = new DigestInputStream(in, sha);
int b;
while ((b = din.read()) != -1) ;
din.close();
byte[] digest = sha.digest();
- @
- 838 orders completed
- ANSWER
-
Tutor has posted answer for $20.00. See answer's preview
***** BluAttached please **** a ****** **** two *** ******* ** **** **** *** folder *** got two ******* for ****** ***** *** *** on **** ******* *** ****** *** ****** **** ******* *** ****** *** need ** ****** *** **** ***** ** ********* eg Java *** filename1ext ************ ************ ***** ********* ********* *** ********* ** *** **** of *** **** and *** ** *** ******** of *** file ** *************** * **** tested *** files *** **** *** working ******* *** **** doesn't *** Thread you **** ** change the ******** **** * **** indicated ** *** ******* such as 'Aclass' to **** ********* ** your system ** **** not insert ***** as ********* ***** ********** is only ********* ** *** **** ****** It can't ** ******* ** *** run ****** ** ******** am ******* forward ** hearing **** ******* *****************