Pad '0' on left of SHA1 hex-encoding

Fix a bug where I forgot to ensure that the encoding must be 40
characters. If it is less, then it needs to padded with '0' on the left.