- Kiat Chun
- PowerBuilder
- Monday, 12 August 2019 08:16 AM UTC
Hi team,
Need some advice how to encrypt text to SHA1 using PowerBuilder.
I have a PHP code below that SHA1-encrypts a string:
$password = "2ctobeR2018";
$password = sha1($password);
echo $password;
yields:
f49182154133c2a2d9b4098cede92642b013110c
However trying to achieve the same using PowerBuilder:
String ls_data
ls_data = "2ctobeR2018" //string from sle_ control
CrypterObject lnv_CrypterObject
lnv_CrypterObject = CREATE CrypterObject
Blob lblb_pwd
lblb_pwd = lnv_CrypterObject.SHA (SHA1!, Blob (ls_data, EncodingANSI!))
MessageBox ("Encrypted Password", String (lblb_pwd, EncodingANSI!))
yields the text below, which is different from PHP output above.
Need to know what is wrong; if I'm doing it incorrectly, wrong function, or am I missing something ?
Also tried other encoding, and but always getting extended characters.
Any advice appreciated. Thanks
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.