e-CryptIt Engine Xojo Plugin

HMAC_SHA_384 Class (console safe)

Implements Keyed-Hashing using SHA_384 for message authentication in compliance with RFC 2104.

This algorithm has been tested against official test vectors.

Object
   HMAC_SHA_384

class HMAC_SHA_384 implements

IHashAlgorithm

Constructors

HMAC_SHA_384The constructor for the HMAC_SHA_384 takes a key as a parameter.

Methods

FinalUse this function when you are done adding bytes to the HMAC_SHA_384 class.
shared HashConvenience shared function to hash small data with just one line of code without creating instance of the class.
UpdateUse this method to add data with MemoryBlock to the HMAC_SHA_384 stream.
UpdateUse this method to add data with String to the HMAC_SHA_384 stream.

Constants

Version = 16.12

Test case for a known test vector


Dim key as String
Dim data as String
Dim hmac as HMAC_SHA_384
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_384(key)

hmac.Update(data)

result = hmac.Final()

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

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

Supported Platforms:

  • macOS Intel 64 bit
  • macOS Apple Silicon
  • Windows 32 bit
  • Windows 64 bit
  • Windows ARM 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM 32 bit
  • Linux ARM 64 bit
  • iOS