commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Hammers ...@lathspell.de>
Subject Re: [codec] MD5 impls
Date Thu, 30 Aug 2012 22:05:46 GMT
Am Thu, 30 Aug 2012 19:58:54 +0200
schrieb Thomas Neidhart <thomas.neidhart@gmail.com>:

> On 08/30/2012 06:31 PM, Gary Gregory wrote:
> > On Thu, Aug 30, 2012 at 11:53 AM, sebb <sebbaz@gmail.com> wrote:
> > 
> >> On 30 August 2012 16:51, Gary Gregory <garydgregory@gmail.com>
> >> wrote:
> >>> On Thu, Aug 30, 2012 at 11:41 AM, sebb <sebbaz@gmail.com> wrote:
> >>>
> >>>> On 30 August 2012 16:01, Gary Gregory <garydgregory@gmail.com>
> >>>> wrote:
> >>>>> All,
> >>>>>
> >>>>> Do we want both the MD5 in
> >>>>> org.apache.commons.codec.digest.Md5Crypt
> >> and
> >>>> the
> >>>>> one accessed through
> >>>>> org.apache.commons.codec.digest.DigestUtils?
> >>>>>
> >>>>> Thouhgts?
> >>>>
> >>>> Are they the same implementation?
> >>>>
> >>>
> >>> Well, no, org.apache.commons.codec.digest.Md5Crypt is new in
> >>> trunk, it
> >> has
> >>> not been in a release yet.
> >>
> >> So why has it been added if there was already an implementation?
> >>
> > 
> > 'twas an oversight.
> 
> it is not the same.
> 
> MD5Crypt uses the MD5 MessageDigest algorithm to produce a crypt
> variant based on it.
> 
> We could replace the call in MD5Crypt
> 
>    MessageDigest ctx = MessageDigest.getInstance(MD5_ALGORITHM);
> 
> with
> 
>    MessageDigest ctx = DigestUtils.getMd5Digest();
> 
> but then we would have to update the exception to be thrown
> (NoSuchAlgorithmException vs. RuntimeException)

Same goes for calls to SHA-256 and SHA-512 instances.
But I actually like getting rid of those checked exceptions that
will usually never occur as well as getting rid of the hardcoded
"SHA-512" algorithm name so I switch to DigestUtils.
Patches coming this weekend!

bye,

-christian-
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message