private static void AppendAsBase32( StringBuilder sb, int value ) { //// NOTE: code is partially based on: //// http://www.anotherchris.net/csharp/friendly-unique-id-generation-part-2/#base62 if( sb.NullReference() ) throw new ArgumentNullException().StoreFileLine(); if( value < 0 ) throw new ArgumentOutOfRangeException().Store("value", value); int remainder = 0; int quotient = Math.DivRem(value /* dividend */, HashCharacters.Length /* divisor */, out remainder); if( quotient > 0 ) AppendAsBase32(sb, quotient); sb.Append(HashCharacters[remainder]); }