I'm facing a similar directory scheme issue as this node Need directory scheme to store 400,000 images

i came across many of the same questions, answers, and realizations in my quest (most notably that dispersion requires reverse name mapping for numerical ids, frontwards for digests).

i've decided against a serial numeric value for the files, and to use a unique md5 digest for the file id

that digest will then be mapped to a series of 2char directories abcdefghij -> ab/cd/ef/abcdefghij

here's where my issue comes in: md5 offers 3 ways to represent the digest -- binary, b16 and b64

binary isn't applicable for directory mapping.
b16 will give me directories with 256 subdirs
b64 will create 4096 subdirs

a b32 representation would, however, create 1024 subdirs -- right around the magic number where many filesystems have issues with the number of files in them

That said, it seems obvious that I would want a base32 representation of the digest -- except that I have no idea how to create this representation. can anyone offer suggestions?

In reply to Making a base32 representation of md5 by nmerriweather

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.