digest.hash_crc32

STRINGdigest.hash_crc32STRINGs

Available inall subroutines.

Returns a CRC-32 digest for the string s. CRC-32 is not a cryptographic hash and is typically used as a fast error-detecting code for detecting changes in raw data.

This algorithm is known as CRC-32/BZIP2.

Example

declare local var.crc32 STRING;
set var.crc32 = digest.hash_crc32("123456789");
# var.crc32 is now "181989fc"

Try it out

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

BETA

Do 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)