Recently I found out how to check my password against the one stored for a user using Python. This works exactly as I want it to:
import base64
import hashlib
salt = "1c183f8f-cc58-495c-b793-43e44439e79a"
password = "my_password"
m = hashlib.md5()
m.update(salt.encode() + password.encode())
print(m.digest())
That results in this output:
b'\xd9\xecI\xa2\xac%\x82!Q\xec\x98\xde\xf9b\x1c\x0b'
The one problem is that I also need to work with a language that doesn't have the same tools (MD5 & base64) so I need to move the heavy lifting to the MSSQL Side. However, when I attempt the same thing here (with both Varchar & Nvarchar):
SELECT HASHBYTES('MD5', '1c183f8f-cc58-495c-b793-43e44439e79a'+'my_password'), 'varchar'
UNION
SELECT HASHBYTES('MD5', N'1c183f8f-cc58-495c-b793-43e44439e79a'+N'my_password'), 'nvarchar'
The output looks like this:
0xD9EC49A2AC25822151EC98DEF9621C0B varchar
0x85AABEB6B209C53FAB7A015EE7344B7D nvarchar
What am I missing? The one difference seems to be that Python requires it to be a Byte as an input. I'm not sure if that's what's impacting the results.