W3C home > Mailing lists > Public > www-jigsaw@w3.org > March to April 1999

Re: Md5 fault fixed.

From: Yves Lafon <ylafon@w3.org>
Date: Wed, 7 Apr 1999 09:52:13 +0200 (MET DST)
To: Christopher William Turner <cwturner@cycom.co.uk>
cc: "www-jigsaw@w3.org" <www-jigsaw@w3.org>
Message-ID: <Pine.GSO.4.10.9904070946250.21957-100000@tarantula.inria.fr>
On Tue, 6 Apr 1999, Christopher William Turner wrote:

> I have fixed a deprecation warning in my copy of
> Jigsaw 2.0.1 org/w3c/tools/crypt/Md5.java
> 
> The warning was significant since the deprecated method did not
> correctly
> convert a String to bytes (would only handle ascii text correctly).
> My fix should give the same checksums as the old version
> for ascii text and will now also
> handle all unicode characters.
> 
> My fixed constructor starts as follows:-
> 
>     /**
>      * Construct a digestifier for the given string.
>      * @param input The string to be digestified.
>      */
> 
>     public Md5 (String input) {
>  byte bytes [] = null;
>  try {
>      bytes = input.getBytes ("UTF8");
>  } catch(UnsupportedEncodingException e){
>      throw new RuntimeException("no UTF8 encoding!!!");
>  }
>  this.stringp = true ;
>  this.in      = new ByteArrayInputStream (bytes) ;
> 

Thanks, fixed!
In fact I added a new constructor 
    public Md5 (String input, String enc) {
}
and the original one call this(input, "UTF8");
It allows more flexibility.
On top of that the class doesn't use any deprecated method any longer!
(available from
http://dev.w3.org/cgi-bin/cvsweb/java/classes/org/w3c/tools/crypt/
later today (it has to be synched with the cvs repository)

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    
Received on Wednesday, 7 April 1999 03:55:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:29 GMT