digest.hash_sha256

STRINGdigest.hash_sha256STRINGs

Available inall subroutines.

Returns a SHA-256 cryptographic hash for the string s.

Example

declare local var.hash_sha256 STRING;
set var.hash_sha256 = digest.hash_sha256("123456789");
# var.hash_sha256 is now "15e2b0d3c33891ebb0f1ef609ec419420c20e320ce94c65fbc8c3312448eb225"

Try it out

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

AWS S3 bucket origin (private)

Use AWS authenticated requests (signature version 4) to protect communication between your Fastly service and AWS.