Available in all subroutines.
Returns a SHA-1 cryptographic hash for the string
s. SHA-1 has known
attacks reducing its strength by over half and should not be considered
a strong cryptographic hash function.
declare local var.hash_sha1 STRING;set var.hash_sha1 = digest.hash_sha1("123456789");# var.hash_sha1 is now "f7c3bc1d808e04732adf679965ccc34ca7ae3441"
Try it out
digest.hash_sha1 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.
Check validity of inputs using a non-crypto hash
Block or identify syntactically invalid requests at the edge by using a hash function of your choice.
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.