PowerBuilder
PowerBuilder
MD4 Hash a String
See more Encryption Examples
MD4 hash a string.Chilkat PowerBuilder Downloads
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
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