CRC-32B Hash Code Calculator
Published: February 10, 2025 at 4:30:19 PM UTC
Hash code calculator that uses the CRC-32B (Cyclic Redundancy Check 32 bit, B variant) hash function to calculate a hash code based on text input or file upload.Cyclic Redundancy Check (CRC) is an error-detecting code commonly used to detect accidental changes to raw data. While not technically a cryptographic hash function, CRC-32 is often referred to as a hash due to its ability to produce a fixed-size output (32 bits) from variable-length input. The version presented on this page is the CRC-32B variant, which is really just a quirk in the PHP language that flips the bits around (little-endian vs big-endian in the original CRC-32).
Full disclosure: I did not write the specific implementation of the hash function used on this page. It is a standard function included with the PHP programming language. I only made the web interface to make it publicly available here for convenience.
About the CRC-32B Hash Algorithm
I'm not a mathematician, but I'll try to explain this hash function with a simple analogy. Unlike many of the cryptographic hash functions, it's not a particularly complicated algorithm, so it'll probably be okay ;-)
Imagine you're sending a letter in the mail, but you're worried it might get damaged before it arrives at the recipient. Based on the content of the letter, you calculate a CRC-32 checksum and write that on the envelope. When the recipient receives the letter, he or she can then also calculate the checksum and see if it matches what you wrote. If it does, the letter was not damaged or changed along the way.
The way CRC-32 does this is a four step process:
Step 1: Add Some Extra Space (Padding)
- CRC adds a little extra room at the end of the message (like packing peanuts in a box).
- This helps it spot errors more easily.
Step 2: The Magic Ruler (The Polynomial)
- CRC-32 uses a special "magic ruler" to measure the data.
- Think of this ruler like a pattern of bumps and grooves (this is the polynomial, but don't worry about that word).
- The most common "ruler" for CRC-32 is a fixed pattern.
Step 3: Sliding the Ruler (Division Process)
- Now CRC slides the ruler across the message.
- At each spot, it checks if the bumps and grooves line up.
- If they don't line up, CRC makes a note (this is done using simple XOR, like flipping switches on or off).
- It keeps sliding and flipping switches until it reaches the end.
Step 4: The Final Result (The Checksum)
- After sliding the ruler across the entire message, you're left with a small number (32 bits long) that represents the original data.
- This number is like a unique fingerprint for the message.
- This is the CRC-32 checksum.
The version presented on the page is the CRC-32B variant, which is mostly a PHP quirk that switches the bit order around (little-endian vs big-endian). You should probably only use this version if you specifically need compatibility with another PHP application that uses it.
I do have calculators for the other variants as well: