e-CryptIt Engine Xojo Plugin |
|
HMAC_SHA_512 Class (console safe)
Implements Keyed-Hashing using SHA_512 for message authentication in compliance with RFC 2104.
This algorithm has been tested against official test vectors.
Object
HMAC_SHA_512
class HMAC_SHA_512 implements
IHashAlgorithm
Constructors
HMAC_SHA_512 | The constructor for the HMAC_SHA_512 takes a key as a parameter. |
Methods
Final | Use this function when you are done adding bytes to the HMAC_SHA_512 class. |
Update | Use this method to add data with MemoryBlock to the HMAC_SHA_512 stream. |
Update | Use this method to add data with String to the HMAC_SHA_512 stream. |
Test case for a known test vector
Dim key as String
Dim data as String
Dim hmac as HMAC_SHA_512
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_SHA_512(key)
hmac.Update(data)
result = hmac.Final()
// Convert to HEX
For i = 1 to 64
hexResult = hexResult + Right("0"+Hex(Asc(Mid(result,i,1))),2)
next
if hexResult = "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737" 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