Crypto.HMAC

From Xojo Documentation

Method

Crypto.HMAC(key As String, data As MemoryBlock, hashAlgorithm As Crypto.Algorithm) As MemoryBlock

New in 2012r2

Supported for all project types and targets.

Creates the hash-based message authentication code using the data and the supplied key value and the supplied hashAlgorithm.

Notes

The key value is applied to the data before generating the hash.

See HMAC on Wikipedia.

Use the Algorithm enumeration with the Hash method to specify the type of hash:

  • MD5
  • SHA1
  • SHA256
  • SHA512

Sample Code

This example creates a hash using HMAC and SHA512:

Var hash As String
hash = Crypto.HMAC("SaltValue", "YourPasswordSentence", Crypto.Algorithm.SHA512)