digest.hash_sha256

STRINGdigest.hash_sha256STRINGs

Available in all 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 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.

AWS S3 bucket origin (private)

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

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.