This module allows you to create sparse and distributed IDs such as those used for YouTube videos. It uses the modified base 64 character set so that the IDs are suitable for use in URLs. It also makes sure that the first and last chars of your ID are not the dash or underscore characters (this helps some programs detect the URLs correctly, for example when double-clicking to highlight the text).

Any length IDs (greater than two chars) can be created and could be used for blog posts, short URLs, images, videos and many other entities.

Other uses could be salts, session IDs, tokens when checking email addresses and nonces for XSRF tokens.

As an example, let's generate some IDs of varying lengths (just as we did in the SYNOPSIS): For example, for lengths of 2, 6, 11 and 32:

The normal Base64 char set includes all the characters, number and the two characters (+) and (/). Since URLs don't usually like the + or / (they have to be URL encoded), the modified set uses the dash (-) and underscore (_) instead. There is also no use or need for (=) at the end since we are not encoding a value, merely creating a random string.