title: SQL HASHBYTES returns different value
body: <p>In my Application, the HASHBYTES SQL function returns different values for same string. 
  Below is my user creation code. </p>
  
  <pre><code>Guid fillerG = Guid.NewGuid(); 
   using (SqlCommand com = new SqlCommand("INSERT INTO App_Users (UserName, PasswordHash, PasswordSalt) VALUES ('" + userNameTxt.Text + "', HASHBYTES ( 'SHA1', CONVERT(NVARCHAR(100), '" + userPassword.Text +          fillerG.ToString() + "') ),  '" + fillerG.ToString() + "'; ", con))
  {
       com.ExecuteNonQuery();
  }
  </code></pre>
  
  <p>When I compare the above inserted row in my Login Page, It doesn't match.
  This is my comparing script. </p>
  
  <pre><code>SqlCommand loginCom = new SqlCommand("select COUNT(UserID) FROM App_Users WHERE UserName = '" + Login1.UserName + "' AND PasswordHash = HASHBYTES('SHA1', '" + Login1.Password + "' + CONVERT(NVARCHAR(36), PasswordSalt))", loginCon);
  </code></pre>
  
  <p>The first code stores the passwordHash as this:</p>
  
  <pre><code>0xDAC9280F85B40C06314228876717E342432807DB
  </code></pre>
  
  <p>But in the query window, the HASHBYTES function with same value returns this:</p>
  
  <pre><code> 0xA561FBD35713F922AD761594658C193F12B82791
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  Check this Image, The password Hash stored by the code is different than the password generated by the query (the password I gave is 'ee')</p>
  
  <p><img src="https://i.stack.imgur.com/PMIL3.png" alt="Query Output"></p>