MD5 Hash and Base64 encoding
If I have a 32 character string (an MD5 hash) and I encode it using Base64, what's the maximun length of the encoded string? An MD5 value is always 22 (useful) characters long in Base64 notation. Many Base64 algorithms will also append 2 characters of padding when encoding an MD5 hash, bringing the total to 24 characters. The padding adds no useful information and can be discarded. Only the first 22 characters matter. Here's why: An MD5 hash is a 128-bit value. Every character in a Base64 string contains 6 bits of information, because there are 64 possible values for the character, and it