On Mon, 8 Dec 2008 01:35:01 -0800 (PST),
wrote,
quoted or indirectly quoted someone who said :
>I generate md5 for file using the following code:
>
>private static byte[] createChecksum(final File file) throws
>IOException,
> NoSuchAlgorithmException {
> InputStream fis = new FileInputStream(file);
>
> byte[] buffer = new byte[1024];
> MessageDigest complete = MessageDigest.getInstance("MD5");
> int numRead;
> do {
> numRead = fis.read(buffer);
> if (numRead > 0) {
> complete.update(buffer, 0, numRead);
> }
> } while (numRead != -1);
> fis.close();
>
> return complete.digest();
> }
>
>How can I increase the getting md5 for file?
Generate the MD5 purely in RAM with my code at
http://mindprod.com/jgloss/md5.html
Compare the speed. If they are the same, the problem is in the
complexity of computing MD5. You might try a faster hash, like Adler.
If they are different, your problem is in the i/o. You need bigger
buffers, or perhaps reading the file into RAM in a single I/O. without
buffering.
--
Roedy Green Canadian Mind Products
http://mindprod.com
PM Steven Harper is fixated on the costs of implementing Kyoto, estimated as high as 1% of GDP.
However, he refuses to consider the costs of not implementing Kyoto which the
famous economist Nicholas Stern estimated at 5 to 20% of GDP