I have a column of type nvarchar. I would like to get a SHA256 hash of the UTF32 representation of these characters.
I have found HASHBYTES which seems to do the meat of what I want to do, with SELECT HASHBYTES('SHA2_256', MyBinaryData)
.
It also indicates it can operate on nvarchar, but it doesn't indicate how it does the conversion from characters to bytes. I particularly need the hash of the UTF32 representation. How can I get that hash? Is there an in-database way to encode the nvarchar to UTF32 that I can feed to HASHBYTES? Is there another way?