13 Sep '11, 9am

Hash as filename

md5 , sha1 , etc are very handy tools for programmers to generate hashed strings from random or fixed keys. A lot of the times, we simply store these hashes directly into databases, setting the field data type as string, or use the hashes as filenames (handy for creating cache files) or as part of URL. While there is nothing wrong in that, sometimes it bothers me that hashes, which are hexadecimal (base-16) are stored in memory/storage spaces that are of larger base, eg. string-typed field in ASCII encoding can store 28 different character types (essentially making it base-256), in UTF-8: base-(232 ), used as filenames in case-insensitive Non-POSIX Win32 NTFS: whatever base that is consisted of possible UTF-16 characters. To improve on that, translate the hash, usually of hexadecimal, into numbers/strings with larger character sets. One of the easiest and handiest way to a...

Full article: http://uzyn.com/hash-as-filename/