Since SQL Server 2005, there is one built-in function called hashbytes
please by aware if you define the string type as char and varchar , the hash varies.
so , here is one example
to be safe, using Rtrim on nchar type to get the same result vs the varchar one
C# and Sql, If you want to get the same hash for a given string, be sure to use the same encoding logic for the string, like Ascii vs Unicode.
in Java, try the commons-codec,
if you use nvarchar or nchar, make sure use unicde in c# also.
Sql server unicode
something in Java,switched it to unicdoe, follow the same byte orders
No comments:
Post a Comment