digest.hash_sha1
Available inall 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.
Example
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 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.
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
BETADo you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)