PureBasic
PureBasic
MD4 Hash a String
See more Encryption Examples
MD4 hash a string.Chilkat PureBasic Downloads
IncludeFile "CkCrypt2.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
crypt.i = CkCrypt2::ckCreate()
If crypt.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
content.s = "The quick brown fox jumps over the lazy dog"
; The desired output is a hexidecimal string:
CkCrypt2::setCkEncodingMode(crypt, "hex")
; Set the hash algorithm:
CkCrypt2::setCkHashAlgorithm(crypt, "md4")
hashStr.s
hashStr = CkCrypt2::ckHashStringENC(crypt,content)
Debug hashStr
; The output is:
; 1BEE69A46BA811185C194762ABAEAE9
CkCrypt2::ckDispose(crypt)
ProcedureReturn
EndProcedure