digest.hmac_sha1

STRINGdigest.hmac_sha1STRINGkeySTRINGs

Available in all subroutines.

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

Example

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 code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below 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.