title: Safest way to generate a unique hash?
body: <p>I need to produce unique identifiers that can be used in filenames and can be reproduced given the same input values.  I need to produce millions of these identifiers as the source input has millions of combinations.</p>
  
  <p>For simplicity's sake, I will use a small set in the example, but the actual sets can be rather large (hundreds, maybe thousands, of items); larger than could be manually encoded into a filename.</p>
  
  <p>I noticed that the <a href="https://docs.python.org/2/library/uuid.html#uuid.uuid5" rel="noreferrer">5th method of generating UUID's</a> allows you to provide a string input.</p>
  
  <pre><code>&gt; input_set = {'apple', 'banana', 'orange'}
  &gt; uuid.uuid5(uuid.NAMESPACE_URL, pickle.dumps(input_set)).hex
  'f39926529ad45997984643816c1bc403'
  </code></pre>
  
  <p>The documentation says it uses <code>SHA1</code> under the hood.  Is the risk of a collision too high?  Is there a better way of reliably hashing unique identifiers?</p>