jonseymour
jonseymour

Reputation: 1106

Where can I find a Linux implementation of cksum that does what OSX cksum -o3 does?

I am trying to reproduce the CRC32 calculations that the u-boot crc32 command does with a Linux utility.

I have discovered, by experiment, that OSX cksum command, with the -o3 option will produce identical check sums to those produced by u-boot crc32 command, but that the GNU coreutils version of cksum does not support the -o3 option and does not produce the same results as u-boot crc32. I have also tried the GNU coreutils 'sum' command.

Does anyone know of a debian package that has a cksum command (or equivalent) that produces the same outputs as the cksum -o3 command on OSX?

Upvotes: 0

Views: 877

Answers (2)

nisetama
nisetama

Reputation: 8933

There is also a crc32 command that is installed by apt-get install libarchive-zip-perl in Debian:

$ printf %i\\n 0x$(crc32 <(printf aa))
126491095
$ crc32 <(printf aa)
078a19d7

In OS X cksum -o3 also prints the length in a second column though:

$ printf aa|cksum -o3
126491095 2

Upvotes: 0

Alper
Alper

Reputation: 13250

The cksum from package coreutils doesn't support -o3 option, however, there is another cksum from freebsd-buildutils with -o3 support.

$ sudo apt-get install freebsd-buildutils

After installation of freebsd-buildutils, be sure that you run the correct cksum.

$ dpkg-query -L freebsd-buildutils

gives the file list installed with freebsd-buildutils, for example in my environment it is in /usr/lib/freebsd/cksum

Upvotes: 0

Related Questions