(PowerBuilder) MD4 Hash a String
MD4 hash a string.
integer li_rc
oleobject loo_Crypt
string ls_Content
string ls_HashStr
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Crypt = create oleobject
// Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
destroy loo_Crypt
MessageBox("Error","Connecting to COM object failed")
return
end if
ls_Content = "The quick brown fox jumps over the lazy dog"
// The desired output is a hexidecimal string:
loo_Crypt.EncodingMode = "hex"
// Set the hash algorithm:
loo_Crypt.HashAlgorithm = "md4"
ls_HashStr = loo_Crypt.HashStringENC(ls_Content)
Write-Debug ls_HashStr
// The output is:
// 1BEE69A46BA811185C194762ABAEAE9
destroy loo_Crypt
|