The *nix md5sum program outputs only in hexadecimal and cites RFC
1321 in its manual (http://www.faqs.org/rfcs/rfc1321.html.) RFC 1321
provides a reference implementation that only prints in hex.
Md5 digests are 128 bits wide; encoded in hexadecimal is 32 bytes wide
compared to 24 bytes in Base64, so space savings for 128 bit words is
not a huge concern.
The small case insensitive character set of hexadecimal 0-9 and a-f
(16) makes it seem more workable than Base64's A-Z, a-z, 0-9, +,
and / (64.) Also + and / need to be encoded if used in a URL.
Hexadecimal seems to be the defacto standard if no encoding is
specified. It would seem valuable to be able to specify an encoding
type, but at the same time very good guesses can be made if no type is
specified by looking at the character set and length of the encoded
Matt, could you cite the part of the HTTP spec that specifies that MD5s
be encoded Base64? the only thing I can find is related to RFC 3230
(http://www.ietf.org/rfc/rfc3230.txt) suggesting a method for HTTP
Instance Digests. Instance Digests are used to verify the fixity of the
HTTP body transmission. I would not use consistency with Instance
Digests as a good argument to encode message digests in Base64 as
opposed to hexadecimal because Instance Digests have nothing to do
with XML or HTML, just HTTP.
In the end I would argue to be able to specify an encoding type, but
default to hexadecimal if not specified.
Florida Digital Archive Programmer/Analyst
Florida Center for Library Automation
[log in to unmask]
On Tue, Feb 06, 2007 at 10:19:41AM -0600, Matt Cordial wrote:
> Is there any best practice or requirement concerning the preferred
> encoding of MD5 digests in the fixity element? I notice that the vast
> majority of the examples are hex encoded (which ends up being 32
> characters). We are developing a web service and because the HTTP spec
> specifies that MD5's be Base64 encoded we were wondering if we could use
> Base64 encoded digests instead of hex encoded? If there is not an
> encoding requirement, should there be a way to specify how these digests
> are encoded?
> Matt Cordial
> Visiting Research Programmer
> Groaner Engineering Library
> University of Illinois Urbana-Champaign
> [log in to unmask]