regarding extracting of packet and checking its crc


 
Thread Tools Search this Thread
Top Forums Programming regarding extracting of packet and checking its crc
# 1  
Old 11-29-2007
regarding extracting of packet and checking its crc

hello,

I have implemented a 32bit crc generation algorithm. Now at the receiver side i need to check the crc for that....i need to add the message in the packet and the crc and divide it with the key common at both side and the remainder should be zero.

now how to add crc which is hexadecimal with the string.

thanks
# 2  
Old 11-29-2007
Quote:
Originally Posted by madfox
now how to add crc which is hexadecimal with the string.
What format is the data in? What protocol do you use to exchange the data? You need to be much more specific.

So far all I can say from what you say is

memcpy(p+1+strlen(p),crc,sizeof(crc));

which I am sure is not what you are intending....
# 3  
Old 11-30-2007
about the data

hello,

i only need to verify the data after i received it
the packet is of size 144 byte : message 140 byte +crc 4 byte
the messege received is a simple string and the crc send is a hexadecimal and received the same.
now i need to add the string and hexdecimal (so need to convert them both to same format)lets say convert the string to decimal (ascii value ) and hexdecimal to decimal.
and add the both......
then divide it by key .......i get the remainder zero if the message is not corrupted.
should this be the way to check the the packet validation of the data with the crc at the receiver end.
assume that i have received the data in the afore said format

thanking you
# 4  
Old 12-10-2007
Traditionally CRC's are transmitted along with the data in binary. Look, for instance, at ethernet packets.

eg...

[ data ] [ crc ]
# 5  
Old 12-19-2007
This will not work, a 32 bit CRC will not fit in "4 bytes of hex". While 32 bits is indeed 4 bytes, a byte has 2^8 (256) possible values; base 256 (haha).

You are implying that the spec is transfering a 32 bit CRC value using "hexidecimal". This effectively reduces the resolution for each byte to 16 values. In doing so, to represent the entire range of 32 bit CRC values it will need 8 hexidecimal "bytes".

More simply stated, the biggest value for a 32 bit CRC is 2^32-1 (hex "FFFFFFFF"). This sequence of hexidecimal characters will occupy 8 bytes if translated verbatim.

Given this, I think you are very confused by something.... I am just not sure what. All the "convert the string and CRC to decimal" [sic] talk makes no sense to me. You have an algorithm that generates a CRC from a piece of data. The receiver should use the same alogoirthm, generate a CRC, and compare against the CRC sent with the data.

If the protocol does something more complicated then you need to understand what that is. For example, you mention a "common key" which I presume is the CRC, but I have no idea.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get CRC check sum of files in java EAR file without extracting .jar/.war files to disk.?

unzip -v gives CRC info of each file in a zip(in my case .EAR) file. # unzip -v my-application.ear Archive: my-application.ear Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 197981 Defl:N 183708 7%... (1 Reply)
Discussion started by: kchinnam
1 Replies

2. AIX

Packet loss coming with big packet size ping

(5 Replies)
Discussion started by: Vishal_dba
5 Replies

3. SCO

Stop boot system at "Checking protected password and checking subsystem databases"

Hi, (i'm sorry for my english) I'm a problem on boot sco unix 5.0.5 open server. this stop at "Checking protected password and checking subsystem databases" (See this image ) I'm try this: 1) http://www.digipedia.pl/usenet/thread/50/37093/#post37094 2) SCO: SCO Unix - Server hangs... (9 Replies)
Discussion started by: buji
9 Replies

4. Programming

64-bit CRC Transition To Bytewise Lookup-Table

Good Evening, I started working on the 17x17 4-colouring challenge, and I ran into a bit of an I/O snag. It was an enormous headache to detect the differences in very similar 289-char strings. Eventually, it made more sense to associate a CRC-Digest with each colouring. After learning... (0 Replies)
Discussion started by: HeavyJ
0 Replies

5. Solaris

Can't PowerOn M3000 - Bad Data CRC

Hi, I was working on the M3000 and I did a init 0, powered off the system during the weekend. When I tried to poweron today, the XSCF linux boot image keeps on rebooting and does not go to the login for XSCF access. The "Check" LED is on amber. Tried diagnosing but cant get the system up. Any help... (1 Reply)
Discussion started by: incredible
1 Replies

6. Programming

CRC Code

Hi, We have packet of size 144 bytes and wants to genrate & check CRC . Can u give the CRC code ? (3 Replies)
Discussion started by: namrata5
3 Replies

7. Solaris

invalid compressed data--crc error

I am getting this error when trying to unzip a file.gz . Anyone know how to resolve this ? (3 Replies)
Discussion started by: jxh461
3 Replies

8. UNIX for Advanced & Expert Users

Does tar do crc checking on a tape or tar file?

Trying to answer a question about whether tar table-of-contents is a good tool for verifying tape data. (1 Reply)
Discussion started by: tjlst15
1 Replies

9. IP Networking

Seeing IP packet

Hi, Is there any way that i can directly take out the IP packet and see its contents. Waiting for your answer .............. Bye (4 Replies)
Discussion started by: manjunath
4 Replies

10. Filesystems, Disks and Memory

crc error ? ? ? ? H E L P

there is a message crc error when i install rethat 7.1 what is these message means ? And why is my harddisk drive detected as hdc not hda ?? please do reply if you have any idea or guesses . thanking you all systen config : intel P4 intel 845 256 SD ... (1 Reply)
Discussion started by: immanuelgangte
1 Replies
Login or Register to Ask a Question