title: Hash Collision - what are the chances?
body: <p>I have some code on my PHP powered site that creates a random hash (using <code>sha1()</code>) and I use it to match records in the database.</p>
  
  <p>What are the chances of a collision? Should I generate the hash, then check first if it's in the database (I'd rather avoid an extra query) or automatically insert it, based on the probability that it <em>probably</em> won't collide with another.</p>