| e-CryptIt Engine REALbasic Plugin |
|
MD5 Class
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 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:
PPC - MacOS 9Carbon - MacOS 9 and MacOS X (PEF)MacOS X PPC - (Mach-O)MacOS X Universal Binary (Mach-O)Win32 - WindowsLinux x86