title: Map unique number to a unique string of 6 characters
body: <p>I have a database table where every row has its unique ID (RowID).</p>
  
  <p>Is there a good way to convert this RowID to a unique key that is always 6 characters in length. Unique key characters can be {A-Za-z0-9}. One example of unique key would be: a5Fg3A.</p>
  
  <p>Of course I do realize there's only certain number of keys I can generate using this method but that doesn't matter for my case.</p>
  
  <p>I've thought much about this but I can't come up with an algorithm that would be able to do this properly.</p>
  
  <p>One idea I had was:
  Unique key = RowID
  If RowID is lower than 100000 then append 0 in front of it, for example:
  123 becomes 000123
  1 becomes 000001</p>
  
  <p>Then for numbers in the range of 100000 to 900000 I would replace first number to a string, e.g. 0 = a, 1 = b, 2 = c, ..., 9 = j.</p>
  
  <p>Then I could do the same with capital letter, etc.</p>
  
  <p>My problem is that my algorithm is very limited and generates low number of keys because it wouldn't utilize all possible characters.</p>
  
  <p>So basically I should be able to generate 56800235584 unique keys assuming every key is of length 6 and utilizes these characters: {A-Za-z0-9}. </p>
  
  <p>A-Z = 26 characters
  a-z = 26 characters
  0-9 = 10 characters</p>
  
  <p>So it's 62^6 unique keys.</p>
  
  <p>Any feedback would be appreciated on how this could be done properly (or even optimal) :-) </p>
  
  <p>Thanks!</p>