incubator-depot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus M. May" <m...@gmx.net>
Subject Re: Wiring up MD5
Date Tue, 11 May 2004 16:44:27 GMT
>>You know about java.security.DigestOutputStream and the similar 
>>java.crypt.MD5OutputStream from the cryptix package, right?  It should 
>>be fairly straightforward to achieve what you want using either of these.
> 
> 
> Nope, I didn't (I am clueless in this area), thanks.
> Markus, any comments?
Jepp, hello,
sorry for the late reply. Currently kind of busy :-(
Anyway, DigestOutputStream handles the digest in the following way:
First of all you have to activate the stream by turn it "on". After it 
is on, every call of the write method (any of them actually) will update 
your digest, meaning that it will update you hashcode you will receive. 
In the HashCodeManager class we use already the DigestInputStream. 
Obviously the InputStream uses the read instead of the write methods to 
update the Digest :-)
The big thing is, that we throw away the stream, therefor it is just 
used for reading the file. Obviously we could extend this a little bit. 
I am not really sure, where we should implement something like this. 
Probably the best place would be the common component. another thing is, 
when this should be executed? during the download, or afterwards? I 
thing afterward is a pretty good quess, but also this is a waste of 
resources, since then we are touching the same file three times 
(downloading, checking and finally copying to the correct name). Also in 
my opinion there should be an option like "strictSecurityCheck" which is 
set to true by default but could be turned off. This is especially 
necessary when you are working in a closed source environment, where not 
every file gets an MD5 hashcode.

What do you think?

R,
Markus

> 
> regards
> 
> Adam
> 
> 


Mime
View raw message