| e-CryptIt Engine REALbasic Plugin |
|
HMAC_MD5 Class
Implements Keyed-Hashing using MD5 for message authentication in compliance with RFC 2104 and 2202.
This algorithm has been tested against official test vectors.
Object
HMAC_MD5
class HMAC_MD5 implements
IHashAlgorithm
Constructors
HMAC_MD5 | The constructor for the HMAC_MD5 class. |
Methods
Final | Use this function when you are done adding bytes to the HMAC_MD5 class. |
Update | Use this method to add data to the HMAC_MD5 stream. |
Test case for a known test vector
Dim key as String
Dim data as String
Dim hmac as HMAC_MD5
Dim result as String
Dim hexResult as String
Dim i as Integer
key = "Jefe"
data = "what do ya want for nothing?"
// We do this in ASCII because the well known test vectors come in ASCII
key = ConvertEncoding(key,Encodings.ASCII)
data = ConvertEncoding(data,Encodings.ASCII)
hmac = new HMAC_MD5(key)
hmac.Update(data)
result = hmac.Final()
// Convert to HEX
For i = 1 to 16
hexResult = hexResult + Right("0"+Hex(Asc(Mid(result,i,1))),2)
next
if hexResult = "750c783e6ab0b503eaa86e310a5db738" 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