Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
03-29-2004, 04:32 PM
|
#1
|
LQ Newbie
Registered: Nov 2003
Distribution: Slackware-current, Red Hat 9
Posts: 18
Rep:
|
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
|
|
|
03-29-2004, 05:05 PM
|
#2
|
LQ Guru
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296
Rep: 
|
|
|
|
03-29-2004, 06:15 PM
|
#3
|
LQ Newbie
Registered: Nov 2003
Distribution: Slackware-current, Red Hat 9
Posts: 18
Original Poster
Rep:
|
Thanks for the response. I'll give those programs a try and tell you if it works out.
|
|
|
03-29-2004, 06:25 PM
|
#4
|
LQ Guru
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,296
Rep: 
|
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.
|
|
|
03-29-2004, 08:41 PM
|
#5
|
LQ Newbie
Registered: Nov 2003
Distribution: Slackware-current, Red Hat 9
Posts: 18
Original Poster
Rep:
|
I didn't have access to python on one of the machines, but the second link worked like a charm. Thanks.
docbrazen
|
|
|
12-09-2005, 10:43 PM
|
#6
|
Member
Registered: Oct 2005
Distribution: Ubuntu 5.10
Posts: 31
Rep:
|
file: md5sum [filename]
string: echo [string] | md5sum
|
|
|
01-03-2011, 06:56 PM
|
#7
|
LQ Newbie
Registered: Feb 2008
Posts: 9
Rep:
|
Quote:
Originally Posted by Xandor
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.
|
|
|
01-03-2011, 07:06 PM
|
#8
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
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!
|
|
|
05-04-2012, 06:42 AM
|
#9
|
LQ Newbie
Registered: May 2012
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();
*/
|
|
|
10-24-2012, 03:52 PM
|
#10
|
LQ Newbie
Registered: Oct 2003
Location: The Great White North
Distribution: Slack
Posts: 2
Rep:
|
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 10:40 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|