Loading TOC...

xdmp:hmac-sha1

xdmp:hmac-sha1(
   $secretkey as item(),
   $message as item(),
   [$encoding as xs:string]
) as xs:string

Summary

Calculates the Hash-based Message Authentication Code (HMAC) using the SHA1 hash function of the given secret key and message arguments.

Parameters
$secretkey The secret key. Must be xs:string or a binary node.
$message Message to be authenticated. Must be xs:string or a binary node.
$encoding Encoding format for the output string, must be "hex" for hexadecimal or "base64". Default is "hex".

Example

  xdmp:hmac-sha1("foo", "bar")
  => "46b4ec586117154dacd49d664e5d63fdc88efb51"
 

Example

  xdmp:hmac-sha1("foo", "bar", "base64")
  => "RrTsWGEXFU2s1J1mTl1j/ciO+1E="
 

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • The documentation should be updated to state that the $message argument can also be a binary node, like so: xdmp:hmac-sha1("foo", binary { xs:hexBinary("DEADBEEF") }) => "7937b957e333379b22d7b61dfaed10414c9f2d81" This is the same signature as the ones for the hmac-sha256 and hmac-sha512 functions.