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
Final | Use this function when you are done adding bytes to the MD5 class. |
Update | Use this method to add data with MemoryBlock to the MD5 stream. |
Update | Use 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 bitMacOS X Cocoa 64 bitWindows 32 bitWindows 64 bitLinux 32 bitLinux 64 bitLinux ARM