title: Python String Comparison function()
body: <p>I am checking a piece of Python code I found online (<a href="http://www.exploit-db.com/exploits/18305/" rel="nofollow">http://www.exploit-db.com/exploits/18305/</a>), and I'm stuck over a piece of code.</p>
  
  <p>To be honest I don't know Python, but I have experience in other programming languages.</p>
  
  <p>The method <code>_computeCollisionChars</code> generates a number of characters and then adds them to a dictionary if they are <em>different</em>. Below is the method signature along with the relevant part for the question. <strong>Note</strong>: The actual code can be found on the linked source.</p>
  
  <pre><code>def _computeCollisionChars(self, function, count, charrange):
      baseStr = ""
      baseHash = function(baseStr) # What is this?
  
      for item in source:
          tempStr = ""
  
          if tempStr == baseStr:
              continue
          if function(tempStr) == baseHash: # What type of comparison is this?
              # logic goes here...
  
      return
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>What does the <code>function</code> parameter mean in the method signature?</li>
  <li>Most importantly what does <code>function(string)</code> do? Why are there two
  checks, and what sort of output does <code>function(tempStr)</code> generate
  then?</li>
  </ol>
  
  <p>Thanks a lot guys!</p>