473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

looking for a complete CRC32 program

I am looking for some source code to run on Linux that will enable me
to calculate and return a CRC32 value from a string of text. I have
found one from snippets.org, but I cannot get it to compile. Please
help me find something that is simple to install, includes all header
and language files and that will compile.
Nov 14 '05 #1
9 10794
UnixUser <ra*********@pfshouston.com> wrote:
I am looking for some source code to run on Linux that will enable me
to calculate and return a CRC32 value from a string of text. I have
found one from snippets.org, but I cannot get it to compile. Please
help me find something that is simple to install, includes all header
and language files and that will compile.


try seraching for "Gary S. Brown" in combination with crc32.
if you have some sources with your linux distro, you probably
already have a few crc32.c's handy though.

anyway, google handed me this site:
http://mia.ece.uic.edu/cgi-bin/lxr/h...=openssh-3.5p1
which seems to work fine for me.

good luck!
grobbeltje.
--
I took a course in speed waiting.
Now I can wait an hour in only ten minutes. -- Steven Wright
Nov 14 '05 #2
grobbeltje <gr*****@hotmail.com> wrote in message news:<br**********@news.tue.nl>...
UnixUser <ra*********@pfshouston.com> wrote:
I am looking for some source code to run on Linux that will enable me
to calculate and return a CRC32 value from a string of text. I have
found one from snippets.org, but I cannot get it to compile. Please
help me find something that is simple to install, includes all header
and language files and that will compile.


try seraching for "Gary S. Brown" in combination with crc32.
if you have some sources with your linux distro, you probably
already have a few crc32.c's handy though.

anyway, google handed me this site:
http://mia.ece.uic.edu/cgi-bin/lxr/h...=openssh-3.5p1
which seems to work fine for me.

good luck!
grobbeltje.


Thanks so much for your reply. This site is to difficult to assemble.
To try to bring the include files and the "c" source file together
will take more time than I have. I downloaded the program and the
crc32.h file, but when I went to bring in the other include file I ran
into much more crap than I can handle. I am not indending on being a
checksum expert I only need a routine as part of a larger project.
Nov 14 '05 #3
Mac
On Wed, 17 Dec 2003 07:48:05 +0000, UnixUser wrote:
I am looking for some source code to run on Linux that will enable me
to calculate and return a CRC32 value from a string of text. I have
found one from snippets.org, but I cannot get it to compile. Please
help me find something that is simple to install, includes all header
and language files and that will compile.


Yeah, that code is full of windows-isms.

You can search and replace DWORD with unsigned long. Then supply a working
macro for UPDC32. I found one by searching on the WWW. Put the macro in
"crc.h"

Then you will have a piece of code that should compile. If, at that point,
you still have problems, post the code here and someone will help you out.
Make sure you post everything needed to try the compilation.

Note that this is not a sources wanted newsgroup, but one for questions about
ISO C.

good luck!

Mac

Nov 14 '05 #4
UnixUser wrote:
.... snip ...
Thanks so much for your reply. This site is to difficult to assemble.
To try to bring the include files and the "c" source file together
will take more time than I have. I downloaded the program and the
crc32.h file, but when I went to bring in the other include file I ran
into much more crap than I can handle. I am not indending on being a
checksum expert I only need a routine as part of a larger project.


Then I suggest you look around here for available programmers who
can handle the problem, and hire one or more of them. You will
have to generate some interface specifications, or require a
consultant for that phase in addition.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #5
UnixUser <ra*********@pfshouston.com> wrote:
This site is to difficult to assemble.
To try to bring the include files and the "c" source file together
will take more time than I have.

i'm a beginner at c, and it took me less time to get it
to work than it took to check my spelling for this reply,
so it can't be very hard...

what exactly is going wrong?

greetings, grobbeltje.
--
"e, s, s, s, n, e, e, nw, get chest, se, n, d" - Sound familiar?
Nov 14 '05 #6
ra*********@pfshouston.com (UnixUser) wrote in message news:<a1************************@posting.google.co m>...
I am looking for some source code to run on Linux that will enable me
to calculate and return a CRC32 value from a string of text.


I once wrote this, I don't know if it's quite what you're looking for though :-)

#include <stdio.h>
#include <stdlib.h>

int main(int a,char **A){FILE*B;typedef unsigned long C;C b
[8]; if(!(a==7&&(B= fopen(1[A],"rb")))) return 1;for(7[b]=0
;7[b]<5;7[b]++)b[7[ b]]=strtoul(A[2+7[b ]],0,16-!7[b]*6);5[
b]=3[b] ; while ((6[b]= getc(B)
)!=(C)- 1){if(2 [b])for (7[b]=0
;7[b]<4 ;7[b]++ )if(((6 [b]>>7[
b])^(6[ b]>>(7-7[b])))&1)6[ b] ^=(1
<<7[b]) ^(1<<(7-7[b]));5[b] ^= 6[b]
<<(0[b] -8);for(7[b]=0;7[b] <8;7[b]
++)if(( 5[b]>>(0[b]- 1))&1)5
[b]=(5[ b]<<1)^ 1[b]; else 5[
b]<<=1; }5[b]&=((((C)1 <<(0[b]
-1))-1) <<1)|1; if(2[b] )for(7[
b]=0;7[ b]<(0[b ]>>1);7 [b] ++)
if(((5[b]>>7[b])^(5 [b]>>(0 [b]-1-7 [b])))&1)5[b]^=((C)
1<<7[b])^((C)1<<(0[ b]-1-7[ b]));5[ b]^=4[b];fclose(B);
printf("%0*lX\n", ( int)(0[ b]+3)>> 2,5[b]); return 0;}

For CRC-32, invoke with the following arguments:
filename 32 04C11DB7 1 FFFFFFFF FFFFFFFF

greetings,
Tom
Nov 14 '05 #7
"Mac" <fo*@bar.net> wrote in message news:<pa****************************@bar.net>...
On Wed, 17 Dec 2003 07:48:05 +0000, UnixUser wrote:
I am looking for some source code to run on Linux that will enable me
to calculate and return a CRC32 value from a string of text. I have
found one from snippets.org, but I cannot get it to compile. Please
help me find something that is simple to install, includes all header
and language files and that will compile.


Yeah, that code is full of windows-isms.

You can search and replace DWORD with unsigned long. Then supply a working
macro for UPDC32. I found one by searching on the WWW. Put the macro in
"crc.h"

Then you will have a piece of code that should compile. If, at that point,
you still have problems, post the code here and someone will help you out.
Make sure you post everything needed to try the compilation.

Note that this is not a sources wanted newsgroup, but one for questions about
ISO C.

good luck!

Mac


Thanks for your kind reply. Replacing the macro "UPDC32" is a little
bit over my head at this point in time.
Nov 14 '05 #8
Mac
On Thu, 18 Dec 2003 20:49:36 +0000, UnixUser wrote:
"Mac" <fo*@bar.net> wrote in message news:<pa****************************@bar.net>...
On Wed, 17 Dec 2003 07:48:05 +0000, UnixUser wrote:
> I am looking for some source code to run on Linux that will enable me
> to calculate and return a CRC32 value from a string of text. I have
> found one from snippets.org, but I cannot get it to compile. Please
> help me find something that is simple to install, includes all header
> and language files and that will compile.


Yeah, that code is full of windows-isms.

You can search and replace DWORD with unsigned long. Then supply a working
macro for UPDC32. I found one by searching on the WWW. Put the macro in
"crc.h"

Then you will have a piece of code that should compile. If, at that point,
you still have problems, post the code here and someone will help you out.
Make sure you post everything needed to try the compilation.

Note that this is not a sources wanted newsgroup, but one for questions about
ISO C.

good luck!

Mac


Thanks for your kind reply. Replacing the macro "UPDC32" is a little
bit over my head at this point in time.


Oh, no, you wouldn't be replacing it. What I had in mind was cutting and
pasting a definition from the internet into your own code. One of the
reasons the snippet doesn't compile is that this macro isn't defined
anywhere in the snippet.

For example at this URL:

http://cctr.umkc.edu/ftp/anon_ftp/pub/SRC/ZMODEM/CRC.C

I found this:

#define UPDC32(octet, crc) (crc_32_tab[((crc) ^ (octet)) & 0xff] ^ ((crc) >> 8))

(sorry, it's a long line. If it breaks, reconstruct it manually)

The code seems to obviously be from the snippet code, so I imagine that
the macro definition will work.

Anyway, good luck.

Mac
--

Nov 14 '05 #9
In article <a1**************************@posting.google.com >,
ra*********@pfshouston.com says...
Thanks for your kind reply. Replacing the macro "UPDC32" is a little
bit over my head at this point in time.


Save yourself some time and google for "Hacker's Delight". It's a great
book, but from your own definition above, probably too deep in general
to purchase right now anyway. However, the author has a website, and
there are several different fully implemented CRC implementations
available.

--
Randy Howard _o
2reply remove FOOBAR \<,
______________________()/ ()______________________________________________
SCO Spam-magnet: po********@sco.com
Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ricky Romaya | last post by:
Hi, I'm working on a file upload script. I need to calculate the CRC32 of the file(s) which are successfully uploaded. How can I do this? PHP only have CRC32 function for strings. However, the...
1
by: PaullyB | last post by:
Hi, I am attempting to convert the following code written in c to equivalent java code. This is the CRC32 algorithm used by a GPS received I am interfacing with. Unfortunately, the CRC32 class...
6
by: Weiguang Shi | last post by:
Hi there, I'm thinking of using binascii.crc32 as a hash-function when I read in the reference http://www.python.org/doc/current/lib/module-binascii.html: crc32( data) Compute CRC-32, the...
14
by: Don | last post by:
Hi NG. Does anyone know of a place where I could download/get a C implementation of a CRC32 check. I would like a simple function that, for example, had a pointer to where the data to be CRC32...
3
by: Russell Mangel | last post by:
Hi, I would like to encapsulate the following CRC32 routine inside a C++ un-mananged class. I am having difficulty initializing the "const static unsigned int table" inside an un-managed C++...
6
by: Paul M. | last post by:
Hello, does anyone have either a User Function Library (or the source for one) to create a CRC32 checksum for a given string? I want to use the function in a crystal formula thus: formula =...
12
by: Larry Bates | last post by:
I'm trying to get the results of binascii.crc32 to match the results of another utility that produces 32 bit unsigned CRCs. binascii.crc32 returns results in the range of -2**31-1 and 2**21-1....
2
by: tlsk | last post by:
Hi I need to calculate the crc32 value for an unsigned array in C++.It goes like this.. unsigned char Myarray; //Myarray contains hex value ... b525b4d0ad533acee2d6a214453a279e Need to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.