Why was the Content-MD5 header base64-encoded?

Viewed 1390

So the Content-MD5 HTTP header has been removed because it wasn't implemented consistently. But looking at The HTTP/1.1 spec, I saw this curious detail:

Content-MD5   = "Content-MD5" ":" md5-digest
md5-digest   = <base64 of 128 bit MD5 digest as per RFC 1864>

What's the use of base64-encoding an MD5 hash before transmission? Why would this:

Content-MD5: MTViMjlmZmRjZTY2ZTEwNTI3YTY1YmM2ZDcxYWQ5NGQ=

Have been better than just this?

Content-MD5: 15b29ffdce66e10527a65bc6d71ad94d
1 Answers

As deceze said in the comment, you're supposed to base64 the MD5 hash, rather than the hex representation of the MD5 hash. This would have resulted in the shorter header:

Content-MD5: FbKf/c5m4QUnplvG1xrZTQ==
Related