title: generate alphanumeric id from auto_increment primary key
body: <p>in my table, i insert new records of user(new users). I have a int set as field primary key. What i want is to make this id secure. Because this id public to everyone. Any user or people can see this id.</p>
  
  <p>If id i generate is like this:</p>
  
  <pre><code>0000000001
  ...
  0000000023
  ...
  0000000157
  ...
  </code></pre>
  
  <p>it is easy for another person to guess it because ids are in a order which is incremented by 1. Instead, i want to store a "public" id in a separate field which is a aplhanumeric representation of this auto_increment primary id.</p>
  
  <p>So in database, table will be like this:</p>
  
  <pre><code>id------------------public_id
  ---------------------------------
  0000000001 -------- W3UB3VNAU3222
  0000000002 -------- 7BNXYO28CN2KK
  </code></pre>
  
  <p>I thought about using hash. But hash is a fixed length of 40 or above. But i want the public id to be fixed 10 characters in length. Should be unique and if possible, I prefer generating it from <code>id</code></p>
  
  <p>plz tell how to create this ? any builtin functions that helps me to do this?</p>
  
  <hr>
  
  <p>I read about <code>hash()</code> <a href="http://php.net/manual/en/function.hash.php" rel="nofollow">function</a> with <code>crc32</code>:<a href="http://www.php.net/manual/en/function.hash.php#104987" rel="nofollow">http://www.php.net/manual/en/function.hash.php#104987</a> It will give 8 char length hash. Will it conflict in future ?</p>
  
  <p>Test:</p>
  
  <pre><code>echo hash('crc32', '0000000001'); // gives 6c13f76e
  </code></pre>