Crypto.HMAC
From Xojo Documentation
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site! |
Method
Crypto.HMAC(key As String, data As MemoryBlock, hashAlgorithm As Crypto.HashAlgorithms) As MemoryBlock
New in 2020r2
Supported for all project types and targets.
New in 2020r2
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.
![]() |
This item was deprecated in version 2020r1. Please use HMAC method from above as a replacement. |
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.
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 Crypto.HashAlgorithms enumeration with the Hash method to specify the type of hash. It has these values:
- MD5
- SHA1
- SHA2_256
- SHA2_512
HMAC does not support CRC32, SHA3_256 and SHA3_512 modes. Using them will raise an UnsupportedOperationException. |
Sample Code
This example creates a hash using HMAC and SHA512: