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

Md5 fault fixed.

From: Christopher William Turner <cwturner@cycom.co.uk>
Date: Tue, 6 Apr 1999 12:26:16 -0400 (EDT)
Message-ID: <370A34E0.CE8C61FF@cycom.co.uk>
To: "www-jigsaw@w3.org" <www-jigsaw@w3.org>
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) ;

.....

--
Chris Turner, http://www.cycom.co.uk/
Received on Tuesday, 6 April 1999 13:33:11 GMT

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