title: What hash function should I use for a bloom-filter with +128-bit keys?
body: <p><a href="https://github.com/joeyrobert/bloomfilter" rel="nofollow">https://github.com/joeyrobert/bloomfilter</a> uses Random class for the hash function which is a <a href="http://www.dotnetframework.org/default.aspx/4@0/4@0/untmp/DEVDIV_TFS/Dev10/Releases/RTMRel/ndp/clr/src/BCL/System/Random@cs/1305376/Random@cs" rel="nofollow">performance killer</a>.<br>
  What I'm trying to do is input the class with byte[]s instead of a generic argument(T) and get rid of  </p>
  
  <blockquote>
  <pre><code>    private int Hash(T item) {
          return item.GetHashCode();
      }
  </code></pre>
  </blockquote>
  
  <p>I know there is a huge performance benefit but I have no idea how to replace <code>_random.Next(_bitSize)</code> here:</p>
  
  <pre><code>#region Public Methods
  /// &lt;summary&gt;
  /// Adds an item to the bloom filter.
  /// &lt;/summary&gt;
  /// &lt;param name="item"&gt;Item to be added&lt;/param&gt;
  public void Add(T item)
  {
      _random = new Random(Hash(item));
  
      for (int i = 0; i &lt; _numberOfHashes; i++)
          _bitArray[_random.Next(_bitSize)] = true;
  }
  </code></pre>
  
  <p>With some non-retarded line of code that doesn't take thousands of CPU cycles for every single bit.</p>
  
  <p>I know there are lots of other problems with the code that can make it faster/safer.I have them(mostly) fixed and just got stuck on the last one before pushing my changes.<br>
  Any help is really appreciated. </p>