The thing about the existing MD4 implementation is that it wants to process the entire message all at once, whereas the Digest trait defines an interface to incrementally pass in chunks of the message before getting a final digest value at the end. There is no fundamental reason that I'm aware of that MD4 couldn't be updated to implement that interface. However, I didn't do that work when I implemented the Digest trait so I figured moving it to crypto wouldn't make sense until it was updated.
I actually just submitted a pull request that implements MD5 along with creating some utility code that should hopefully be useful for implementing block based digest functions: https://github.com/mozilla/rust/pull/8097 On Sun, Jul 28, 2013 at 4:48 PM, Brian Anderson <[email protected]>wrote: > On 07/28/2013 09:18 AM, Alexei Sholik wrote: > >> Hi guys, >> >> I have implemented Digest for MD4 and added an implementation of MD5. I'm >> keeping the code in a separate repo so that I don't have to rebuild Rust -- >> https://github.com/alco/rust-**digest<https://github.com/alco/rust-digest>. >> There is also a draft of HMAC and an additional utility trait to make it >> easy to get one-off digests from vectors and strings. >> >> I hope that at least MD4 and MD5 can make it into upstream. Can you >> please take a look and give some advice on how I should integrate my MD4 >> changes (just replace the old implementation?) and new MD5 implementation >> into libextra. >> >> One thing in particular that I'm wary about is that the implementations >> for MD4 and MD5 are almost identical -- only the inner loop is different. >> Naturally, I would like to unify them as much as possible by putting both >> into a single module. Any advice on that will be appreciated. >> >> > Right now it looks like we an extra::crypto module that contains a Digest > trait, implemented by a number of SHA variants in crypto::sha1 and > crypto::sha2. Curiously extra::md4 looks to be unrelated to extra::crypto > (I guess it's just old and unmaintained). > > So I have a few questions: > > * Can all digest functions implement Digest? > * Is it appropriate for all digests to live in extra::crypto? Not all > hashes are crypto hashes... > > Based on what we have now I'd recommend deleting extra::md4, moving your > md4/5 into extra::crypto, and integrating them with the Digest trait. > Certainly though I've only given this cursory thought (and I haven't read > your code yet), so other opinions welcome. > > -Brian > ______________________________**_________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev> >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
