10

I need to verify data using CRC32C, the Castagnoli variant of CRC32 calculation. I cannot find a self-contained command line utility anywhere that will calculate this to verify the values in question. CRC32? MD5? SHA? Check. CRC32C? You lose.

I need a program. Has to be self contained (no non-standard PERL or Python modules that require installation...standard ones are okay). Probably no Java, as I cannot guarantee a Java installation. Ruby is right out.

Clever "gzip" or "tar" tricks are fine. Needs to run on OS-X, Linux, and maybe Android.

I could indeed write one (the code is in the RFC), but c'mon...that's sort of like

"hmmm, my car uses synthetic oil...time for an oil change, let me go to the local refinery and make a few quarts"

or

"Uncle Bill wants a PB&J sandwich, but has a gluten allergy...let me go get some rice flour and make gluten-free bread".

I found some libraries to calculate CRC32Cs, but no programs. Grumble.

https://developers.google.com/storage/docs/composite-objects?hl=ja

Mark Gerolimatos
  • 2,424
  • 1
  • 23
  • 33

3 Answers3

13

Starting with 4.4, gsutil supports a 'hash' command that can compute hashes like so:

gsutil hash filename

It will output CRC32C and MD5 by default.

Travis Hobrla
  • 5,411
  • 23
  • 22
  • Installing the native crcmod is a bit ugly because it requires to uninstall the existing one. https://cloud.google.com/storage/docs/gsutil/addlhelp/CRC32CandInstallingcrcmod#debian-and-ubuntu – pablo Aug 04 '18 at 17:49
  • 1
    First `pip install gsutil`. – Smeterlink Jul 17 '21 at 20:42
2

So long as you can compile C code, you can find the program you're looking for in this stackoverflow answer. It will also use the Intel crc32 instruction if available.

Community
  • 1
  • 1
Mark Adler
  • 101,978
  • 13
  • 118
  • 158
1

gsutil will include a new "hash" command in the next release (gsutil 4.4) - which should be out pretty soon.

Mike Schwartz
  • 11,511
  • 1
  • 33
  • 36