title: A fast hash function for string in C#
body: <p>I want to hash a string of length up-to 30. What will be the best idea to do that if time is my concern. The function will be called over 100 million times. currently I am using the following code, </p>
  
  <pre><code>static UInt64 CalculateHash(string read, bool lowTolerance)
  {
      UInt64 hashedValue = 0;
      int i = 0;
      while (i &lt; read.Length)
      {
          hashedValue += read.ElementAt(i) * (UInt64)Math.Pow(31, i);
          if (lowTolerance) i += 2;
          else i++;
      }
      return hashedValue;
  }
  </code></pre>