title: Password does not match with hash algorithm (SQL Server)
body: <p>I got a problem with SQL Server. My Task is it to realize a simple SQL Serverbased usersystem with PHP. The databases are also used by a MMORPG so I am not allowed to change the database structure or hashing alogrithms. The real cause of my problem is, that the password is hashed by the following alogrithm</p>
  
  <pre><code>HashBytes('MD5', REVERSE(UPPER(@ID)) + @PW)
  </code></pre>
  
  <p>I created a test user called test123 and pw hallo123 what conforms the password hash "0x7CEE495091E11FF9560D3D01651333220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"</p>
  
  <p>up to this point everything should be clear. Well but when I try to fetch the data by a query I get no results. I ran this query:</p>
  
  <pre><code>mssql_query("SELECT * FROM [DB_Member].[dbo].[Member] WHERE ID = 'test123' AND PW = HashBytes('MD5', REVERSE(UPPER('test123')) + 'hallo123')");
  </code></pre>
  
  <p>Which returns no result. But if I directly run this query</p>
  
  <pre><code>mssql_query("SELECT * FROM [DB_Member].[dbo].[Member] WHERE ID = 'test123' AND PW = 0x7CEE495091E11FF9560D3D01651333220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
  </code></pre>
  
  <p>I get the data without any problems</p>
  
  <p>I'm grappling with this now for about eight hours but I can't figure out the problem.</p>