CRC32 Hash Generator Online

Generate Crc32 code

Enter string to convert to CRC32

The main differences between CRC32C and CRC32B are:

Polynomial: CRC32C uses the polynomial 0x1EDC6F41 (also known as CRC-32C or Castagnoli CRC), while CRC32B uses the polynomial 0x04C11DB7 (also known as CRC-32 or Ethernet CRC). The choice of polynomial affects the error detection capabilities and efficiency of the algorithm.
Implementation: CRC32C can be implemented more efficiently using modern processors that support hardware acceleration for CRC32C instructions, whereas CRC32B may require software-based implementations.
Error detection capabilities: CRC32C has better error detection capabilities than CRC32B, especially for single-bit errors and burst errors.
In general, CRC32C is considered to be a more modern and efficient algorithm than CRC32B, and is often used in applications where high reliability and efficiency are critical.

In Node.js, you can use the built-in crypto module to compute CRC32 checksums using the createHash() method. Here's an example of how to compute the CRC32 checksum of a string:

const crypto = require('crypto');

function crc32(str) {
  const hash = crypto.createHash('crc32');
  hash.update(str);
  return hash.digest('hex');
}

console.log(crc32('hello world')); // prints '3610a686'

In this example, we first import the crypto module, which provides cryptographic functionality for Node.js. We define a crc32 function that takes a string as input, creates a CRC32 hash object using the createHash() method, updates the hash object with the input string using the update() method, and finally computes the CRC32 checksum by calling the digest() method with the 'hex' encoding option.

Note that the 'crc32' algorithm identifier is not available on all platforms, so you may need to verify that it's supported before using it in production code.

Php Example

<?php

// Calculate a 32-bit CRC for a given string

$string = 'Hello World!';

$crc = crc32($string);

echo $crc;

?>

JAVA Example

import java.util.zip.CRC32;

// Calculate a 32-bit CRC for a given string

String string = "Hello World!";

CRC32 crc = new CRC32();

crc.update(string.getBytes());

long checksum = crc.getValue();

System.out.println(checksum);

C Example

#include <stdio.h>
#include <zlib.h>

// Calculate a 32-bit CRC for a given string

const char *string = "Hello World!";

uLong crc = crc32(0L, (const Bytef*)string, strlen(string));

printf("%lu\n", crc);

C++ Example

#include <iostream>
#include <zlib.h>

// Calculate a 32-bit CRC for a given string

std::string string = "Hello World!";

uLong crc = crc32(0L, (const Bytef*)string.c_str(), string.length());

std::cout << crc << std::endl;

Python Example

import zlib

# Calculate a 32-bit CRC for a given string

string = "Hello World!"

crc = zlib.crc32(string)

print(crc)

Flutter Example

import 'dart:typed_data';
import 'package:flutter_crc32/flutter_crc32.dart';

//Calculate a 32-bit CRC for a given string

String string = "Hello World!";

Uint8List data = Uint8List.fromList(string.codeUnits);

int crc = FlutterCrc32.crc32(data);

print(crc);

Ruby Example

require 'zlib'

# Calculate a 32-bit CRC for a given string

string = 'Hello World!'

crc = Zlib.crc32(string)

puts crc

C# Example

using System;
using System.Security.Cryptography;

// Calculate a 32-bit CRC for a given string

string string = "Hello World!";

CRC32 crc = new CRC32();

byte[] data = System.Text.Encoding.ASCII.GetBytes(string);

long checksum = crc.ComputeHash(data);

Console.WriteLine(checksum);

Golang Example

package main

import "hash/crc32"

// Calculate a 32-bit CRC for a given string

func main() {
    string := "Hello World!"

    crc := crc32.ChecksumIEEE([]byte(string))

    fmt.Println(crc)
}

Swift Example

import Foundation
import zlib

// Calculate a 32-bit CRC for a given string

let string = "Hello World!"

let data = string.data(using: .utf8)!

let crc = data.withUnsafeBytes {
    return crc32(0, $0.baseAddress, UInt32(data.count))
}

print(crc)

Kotlin Example

import java.util.zip.CRC32

// Calculate a 32-bit CRC for a given string

val string = "Hello World!"

val crc = CRC32()

crc.update(string.toByteArray())

val checksum = crc.value

println(checksum)