Goal:
Retrieve the same hash value from SQL and C# code.
Problem:
The value of the hash is almost the same. I'm using the same hash and sha.
Input:
"Hello World!'"
C# code:
https://dotnetfiddle.net/2YbFXY
SQL code:
DECLARE @HashThis varchar(32);
SET @HashThis = CONVERT(varchar(32),'Hello World!');
SELECT HASHBYTES('SHA2_256', @HashThis);
Output:
Result of C# code:
"7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069"
Result of SQL code:
"0x7F83B1657FF1FC53B92DC18148A1D65DFC2D4B1FA3D677284ADDD200126D9069"
Is there a good or recommended approach to remove the data "0x"?
Thank you!