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.

Using S3-compatible buckets as private origins

Configure S3-compatible buckets to use as private origins for CDN delivery. Requests are authorized via signature version 4 to protect communication between your CDN service and the bucket. This is compatible with Fastly Object Storage, AWS S3, and most other S3-compatible storage offerings.