Hello,
I don't understand why the string results from sha256 encrypted algorithm are different between pb and the sqlserver query
from the PB code non-printable data are returned :
Blob lblb_data
Blob lblb_sha1
string l_res
// here the data to convert
lblb_data = Blob("003806qxgMB&g4pWF$Y20240625160915", EncodingUTF8!)
CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject
// Encrypt with SHA
lblb_sha1= lnv_CrypterObject.SHA(SHA1!, lblb_data)
// get a string but here non-printable data are returned
l_res = String(lblb_sha1, EncodingUTF8!)
instead if I run the query (sql-server) I see the darta I expect return:
SELECT convert(char(96), HASHBYTES('SHA2_256', '003806qxgMB&g4pWF$Y20240625160915'),2) ;
in this case the result is readble:
4991A0194A9F80D99E75FBA2D0020A1D17802E77D7CFB8773EEDD633FA9B0F47
maybe, do I need to somehow convert the string to pb to get the same result as the query?
thank you
alberto