This page is not complete.

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

This dictionary represents the object that should be passed as the algorithm parameter into SubtleCrypto.importKey(), when generating a key for the HMAC algorithm.


DOMString. This should be set to "HMAC".

DOMString. The name of the digest function to use. You can pass any of "SHA-256", "SHA-384", or "SHA-512" here.

Although you can technically pass "SHA-1" here, this is strongly discouraged as SHA-1 is considered vulnerable.

length Optional

Number. The length in bits of the key. If this is omitted the length of the key is equal to the length of the digest generated by the digest function you have chosen. Unless you have a good reason to use a different length, omit this property and use the default.



Specification Status Comment
Web Cryptography API
The definition of 'SubtleCrypto.HmacImportParams' in that specification.

Browser compatibility

No compatibility data found. Please contribute data for "api.SubtleCrypto.encrypt.algorithm-hmac" (depth: 1) to the MDN compatibility data repository.

Document Tags and Contributors

Contributors to this page: wbamberg
Last updated by: wbamberg,