Available in all subroutines.

Returns a SHA-1-based message authentication code based on the supplied key and string s.


declare local var.hmac_sha1 STRING;
set var.hmac_sha1 = digest.hmac_sha1("key", "input");
# var.hmac_sha1 is now "0x8513bb355076cce2ae5eb9f399ab5cafdba7c8a2"

Try it out

digest.hmac_sha1 is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Time-limited URL tokens

Make URLs expire after a configurable period.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.