Available inall subroutines.

Hash-based message authentication code using SHA-512. Returns a hex-encoded string prepended with 0x.


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

Try it out

digest.hmac_sha512 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.

Flatten the curve of major traffic spikes with a waiting room

A totally stateless solution to hold back new users for a minimum waiting period to smooth out spikes in traffic.