Pretty much as oha said. To state the obvious, there's less chance of a collision if you use (eg) twelve base 64 digits, than if you use twelve base 2 digits ... so, if you use Digest::MD5, get the 'md5_base64' and then truncate.
Oh ... wait ... you specified "decimal" digits. Any particular reason for that ?