title: Two-way "Hashing" of string
body: <p>I want to generate int from a string and be able to generate it back.
  Something like hash function but two-way function.
  I want to use ints as ID in my application, but want to be able to convert it back in case of logging or debugging.</p>
  
  <p>Like:</p>
  
  <pre><code>int id = IDProvider::getHash("NameOfMyObject");
  
  object * a = createObject(id);
  
  ...
  
  if(error)
  {
      LOG(IDProvider::getOriginalString(a-&gt;getId()), "some message");
  }
  </code></pre>
  
  <p>I have heard of slightly modified CRC32 to be fast and 100% reversible, but I can not find it and I am not able to write it by myself.</p>
  
  <p>Any hints what should I use?
  Thank you!</p>
  
  <p><strong>edit</strong> 
  I have just founded the source I have the whole CRC32 thing from:</p>
  
  <p>Jason Gregory : Game Engine Architecture</p>
  
  <p>quotation:</p>
  
  <p>"As with any hashing system, collisions are a possibility (i.e., two different strings might end up with the same hash code). However, with a suitable hash function, we can all but guarantee that collisions will not occur for all reasonable input strings we might use in our game. After all, a 32-bit hash chode represents more than four billion possible values. So if our hash function does a good job of distributing strings evently throughout this very large range, we are unlikely to collide. At Naughty Dog, we used a variant of the CRC-32 algorithm to hash our strings, and we didn't encounter a single collision in over two years of development on Uncharted: Drake's Fortune." </p>