Tcllib md5

The Tcllib md5 module creates MD5 message digests.


official reference (alternate )
official reference , development version


The tcllib implementation of MD5 will defer to the md5 from the Trf package if that is available.

DKF: The version in Tcllib is partially built on MD5Pure.

Hexadecimal Representation

jmn 2004-02-01: Are there some gotchas the novice user should be aware of here? What happens when you use the binary value returned by md5::md5 as part of a string, as in the following snippet taken from Tuplespace

proc tid {tuple} {
    return "\#Tuple[::md5::md5 $tuple]"

See my comments about half way down that page. Basically it looks like md5::md5 of the string hello there test etc returns a value that includes a carriage return. As I guess can be seen by the existence of 0D when you look at the hex result:

% md5 -hex {hello there test etc}

I assume there may be other characters that may cause problems when using the binary result in a string - so presumably one should always use the -hex option for this sort of situation(?)

When and how does one use the binary result then?

PT: You have turned the binary result into the string representation of a binary result there. If you want a string then you should use -hex or in some other way arrange to protect the data. For instance, once a string function is used any embedded nil chars are going to terminate the data. The binary form is required if you are putting the result into a binary format -- for instance a network protocol or embedded into a file format.