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 |
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. |
Quote:
|
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. |
I didn't have access to python on one of the machines, but the second link worked like a charm. Thanks.
docbrazen |
file: md5sum [filename]
string: echo [string] | md5sum |
Quote:
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. |
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! |
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(); */ |
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. |