Tk Library Source Code

View Ticket
Login
Ticket UUID: 864530
Title: md5::md5 -- incompatible API change in 2.0
Type: Bug Version: None
Submitter: jenglish Created on: 2003-12-22 17:34:11
Subsystem: md5 Assigned To: patthoyts
Priority: 8 Severity:
Status: Closed Last Modified: 2004-02-08 08:09:37
Resolution: Wont Fix Closed By: patthoyts
    Closed on: 2004-02-08 01:09:37
Description:
Previously, [md5::md5 $data] returned a result as a hex
string; as of version 2.0, it returns it as binary.
Although this is noted in the ChangeLog, it is easy to
miss, and is sure to cause many hard-to-track-down
errors when users upgrade to the next release of tcllib.

This seems like a gratuitous incompatibility.  Please
make '-hex' the default, for compatibility with tclllib
1.4, and add a '-bin' or '-binary' option for those
that want the new behaviour.
User Comments: patthoyts added on 2004-02-08 08:09:37:
Logged In: YES 
user_id=202636

The quick answer is that full compatability is available if
people
do [package require md5 1]. This loads the original script.

The longer answer is that I believe that the current interface 
for md5 is wrong. md5 defers to compiled implementations if
it can 
find one. Trf returns a binary value, as does the critcl
md5c version
and if you were to use openssl's version that will do so too.
Even in the md5 code itself, it has to convert the hex back
into binary
to perform the hmac algorithm. 

md4 returns a binary value and the checksums (crc{16,32},
cksum and sum) 
return decimal values. All these have a -hex option to get
hex output.
sha1 returns hex bu default, but I would like to redo this
as per the new
md5 too. md5 and sha1 are pretty much enhanced versions of
md4. All these
can use the ability to read data in chunks which is the
point of the new 
verison of md5, and I'd like to add this to sha1 eventually.

So I do not plan to change the new interface as I deem the
old one wrong.
The new manual page already has a note about this. I shall
try and make 
sure its more clear in the documentation.

jenglish added on 2004-01-17 03:26:50:
Logged In: YES 
user_id=68433

Another incompatibility: the old version returned hex digits
in lowercase, the new version returns them in uppercase.

andreas_kupries added on 2004-01-05 05:52:49:
Logged In: YES 
user_id=75003

I note that this incompatibility has not been noted in the
documentation. It should have been.

Over to Pat as he wrote the new code and made the change.