Re: calculating an md4 and a signature at the same time?

Donovan Baarda <[email protected]> Mon, 19 Jan 2004 13:15:54 +1100
Newsgroups gmane.network.librsync.general
Organization http://minkirri.apana.org.au/~abo/
Message-ID <1074478554.2689.23.camel@schizo>
On Thu, 2004-01-15 at 06:17, David Helgason wrote:
> I have an application sending a bunch of deltas to a server. Before 
> actually sending any data, I want to send an md4 sum over to see if the 
> files actually differ (taking my chances of hash-collisions), and if so 
> send the signature to the server.
> 
>  From browsing the librsync (0.9.6) source code, I have the impression 
> that it is possible to calculate these at the same time, but can't 
> quite get a hold on how. Is this actually possible? Or could I use some 
> part of the signature (the last few bytes or sth like that) as a 
> good-enough hash?

Yes, you can calculate the signature and the md4 sum at the same time.
You need to create an rs_mdfour object and the rs_job signature object,
and feed the data to both of them as you go through it. At the end you
have your signature and your md4sum. 

As this is a fairly useful bit of functionality, it might make sense to
add this to the rs_job object so you get an overall md4sum as well as
the signature.

> [standard, but sincere open-source flattery ahead:] I think it's very 
> exciting to have library access to the very elegant rsync algorithm. 
> Beautiful work. I am wondering if I should be working off the 0.9.6 or 
> the CVS-current. I noticed some documentation glitches and suchlike, 
> and could try to send patches if you are interested.

I'm happy to give you CVS commit permissions if you like. Just send me
your SF user details and I will add you. Alternatively you can submit
patches on SF and someone (probably me) will commit them to CVS for you.

If you are submitting patches, it's better to do them against CVS, and
note the CVS checkout date you generated them against in the comments
when you submit it to CVS.


-- 
Donovan Baarda <[email protected]>
http://minkirri.apana.org.au/~abo/



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn