Added option to specify length of base64 output.

Based on a patch posted to the list by Richard Michael.