title: TSQL md5 hash different to C# .NET md5
body: <p>I've generated an md5 hash as below:</p>
  
  <pre><code>DECLARE @varchar varchar(400) 
  
  SET @varchar = 'è'
  
  SELECT CONVERT(VARCHAR(2000), HASHBYTES( 'MD5', @varchar ), 2)
  </code></pre>
  
  <p>Which outputs:</p>
  
  <pre><code>785D512BE4316D578E6650613B45E934
  </code></pre>
  
  <p>However generating an MD5 hash using:</p>
  
  <pre><code>System.Text.Encoding.UTF8.GetBytes("è")
  </code></pre>
  
  <p>generates:</p>
  
  <pre><code>0a35e149dbbb2d10d744bf675c7744b1
  </code></pre>
  
  <p>The encoding in the C# .NET  method is set to UTF8 and I had assumed that varchar was also UTF8, any ideas on what I'm doing wrong?</p>