Don't truncate last 4 bits of encoded hexadecimal string.

Issue reported by Gabriel Handford @gabriel.