Quotes a (file-) name to remove illegal characters and keep it
within a reasonable length for the filesystem.
The md5 hash function is used if the length of the name after quoting is
more than 100 characters. If it is used, then as many characters at the
start of the name as possible are kept intact, and the hash appended to
make 100 characters.
Do not pass filenames with meaningful extensions to this function, as the
hash could destroy them.