title: Is it possible to get identical SHA1 hash?
body: <p>Given two different strings S1 and S2 (S1 != S2) is it possible that:</p>
  
  <pre><code>SHA1(S1) == SHA1(S2)
  </code></pre>
  
  <p>is True?</p>
  
  <ol>
  <li>If yes - with what probability?  </li>
  <li>If not - why not?</li>
  <li>Is there a upper bound on the length of a input string, for which the probability of getting duplicates is 0? OR is the calculation of SHA1  (hence probability of duplicates) independent of the length of the string?</li>
  </ol>
  
  <p>The goal I am trying to achieve is to hash some sensitive ID string (possibly joined together with some other fields like parent ID), so that I can use the hash value as an ID instead (for example in the database).</p>
  
  <p>Example:</p>
  
  <pre><code>Resource ID: X123
  Parent ID: P123
  </code></pre>
  
  <p>I don't want to expose the nature of my resource identifies to allow client to see "X123-P123".</p>
  
  <p>Instead I want to create a new column hash("X123-P123"), let's say it's AAAZZZ. Then the client can request resource with id AAAZZZ and not know about my internal id's etc.</p>