Re: Md5 fault fixed.

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 UTC