[genpass] Rewrite to support any character set.

Instead of relying on various encoding schemas, genpass.pl now does
its own encoding unless using a set of 16 or 64 characters in which
case hex or base64 is used.

This also adds support for custom character sets of arbitrary length.