e-CryptIt Engine Xojo Plugin

MD5 Class (console safe)

MD5 is a message digest/hash algorithm with a digest/hash size of 128 bits (16 characters).

This algorithm has been tested against official test vectors.

Object
   MD5

class MD5 implements

IHashAlgorithm

Methods

FinalUse this function when you are done adding bytes to the MD5 class.
UpdateUse this method to add data with MemoryBlock to the MD5 stream.
UpdateUse this method to add data with String to the MD5 stream.

Test case for a known test vector

Dim data as String
Dim hash as MD5
Dim result as String
Dim hexResult as String
Dim i as Integer

data = "message digest"

// We do this in ASCII because the well known test vectors come in ASCII
data = ConvertEncoding(data,Encodings.ASCII)

hash = new MD5()

hash.Update(data)

result = hash.Final()

// Convert to HEX
For i = 1 to 16
    hexResult = hexResult + Right("0"+Hex(Asc(Mid(result,i,1))),2)
next

if hexResult = "f96b697d7cb7938d525a2f31aaf161d0" then
    return true
else
    return false
end if

Supported Platforms:

  • MacOS X Cocoa 32 bit
  • MacOS X Cocoa 64 bit
  • Windows 32 bit
  • Windows 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM