# `crc32c` Hashing Algorithm

> Section in “New and Extended Functionality › Cryptography and Security” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/cryptography-and-security/crc32c-hashing-algorithm/>

Cyclic redundancy checks (CRCs) are used for verifying data integrity. The most commonly used algorithms for calculating CRC values are CRC-32-IEEE and CRC-32C. The former is used by Ethernet, SATA, bzip2, gzip, and PNG, for instance. The latter is used by btrfs, ext4, iSCSI, and Apache Kafka, for instance.

PHP has supported cyclic redundancy checks using CRC-32-IEEE since PHP 4 using with the `crc32()` function and since PHP 5.1 through the `hash` extension. Support for CRC-32C was added to the `hash` extension in PHP 7.4:

``` php
var_dump(hash('crc32c', 'PHP now supports CRC-32C.'));
```

The result is:

    string(8) "7c5acb60"

---

Previous: [New Hashing Algorithm for Passwords](https://php7explained.com/new-and-extended-functionality/cryptography-and-security/new-hashing-algorithm-for-passwords/index.html.md) | Next: [mail() and mb_send_mail() Hardened Against Header Injections](https://php7explained.com/new-and-extended-functionality/cryptography-and-security/mail-and-mb_send_mail-hardened-against-header-injections/index.html.md)
