Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
Distribution: Currently doing embedded linux so.... Buildroot? ;-)
Posts: 8
Rep:
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();
*/
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.