LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I generate a crc32 checksum? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-generate-a-crc32-checksum-163908/)

docbrazen 03-29-2004 04:32 PM

How do I generate a crc32 checksum?
 
Hi,

Does anyone know how I can generate a crc32 checksum for a file in linux? I tried using cksum, but I think that is something different. I would use md5sum but the person I got the file from doesn't haven access to that.

docbrazen

Peacedog 03-29-2004 05:05 PM

i've never done this, but, here are a few leads.

http://freshmeat.net/projects/checkcrc/

http://www.dakotacom.net/~donut/programs/fchksum.html

hope that helps.
good luck.

docbrazen 03-29-2004 06:15 PM

Quote:

Originally posted by PEACEDOG
i've never done this, but, here are a few leads.

http://freshmeat.net/projects/checkcrc/

http://www.dakotacom.net/~donut/programs/fchksum.html

hope that helps.
good luck.

Thanks for the response. I'll give those programs a try and tell you if it works out.

Peacedog 03-29-2004 06:25 PM

like i said, i have 0 experience w/this. just thought a few leads may get you pointed in the right direction. hope it works out.
good luck.

docbrazen 03-29-2004 08:41 PM

I didn't have access to python on one of the machines, but the second link worked like a charm. Thanks.


docbrazen

Xandor 12-09-2005 10:43 PM

file: md5sum [filename]
string: echo [string] | md5sum

jetole 01-03-2011 06:56 PM

Quote:

Originally Posted by Xandor (Post 1991744)
file: md5sum [filename]
string: echo [string] | md5sum

The op asked how to generate a crc32 checksum. While the lines you posted will produce a checksum, they will be using a MD5 hash instead of the CRC (Cyclic Redundancy Check) hash.

As far as I know, most distributions don't have a crc32 tool packaged with them as I was just looking for the same thing myself. Ubuntu (10.04) doesn't seem to have one in the repos either though it does have some perl libs for crc32 generation so if you know perl then you can whip one together. I think I am going to do this tonight myself.

GrapefruiTgirl 01-03-2011 07:06 PM

Hi jetole,

thanks for adding some potentially helpful information to this thread.

I just wanted to point out though (a friendly FYI :) ) in case you didn't notice, this thread is very old, and the OP has not even logged in in 6 1/2 years; so while some folks may benefit from any info you add, it's quite possible that the OP will not.

Anyhow, cheers & have a great day!

IamaHack 05-04-2012 06:42 AM

Libz exports the crc32 function
 
I know this is an older post, but for those who end up here, the common library that is part of almost every distribution is libz.so which exports an implementation of the crc32:

ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. If buf is Z_NULL, this function returns the required
initial value for the for the crc. Pre- and post-conditioning (one's
complement) is performed within this function so it shouldn't be done by the
application.

Usage example:

uLong crc = crc32(0L, Z_NULL, 0);

while (read_buffer(buffer, length) != EOF) {
crc = crc32(crc, buffer, length);
}
if (crc != original_crc) error();
*/

striek 10-24-2012 03:52 PM

Yes I know, very old thread, but I came across this from a google search and then later solved the problem.

cksum will calculate a crc32 checksum, it should be available on any linux system.


All times are GMT -5. The time now is 08:58 AM.