GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 17-Aug-2006, 00:44
a3.charles a3.charles is offline
New Member
 
Join Date: Jul 2006
Posts: 17
a3.charles is on a distinguished road

Hexadecimal Checksum Characters


Hi,

I'm currently writing a program that will command a peripheral device by receiving a sentence. In order for it to interpret the sentence it must end with two hexadecimal checksum charaters . The checksum is the hexadecimal representation of the exclusive-or of all the remaining characters in the sentence.

At the moment i'm exclusive ORing the remaining characters in the sentence, however, this only gives me a result of one character, i'm unsure what to do. Any guidance would be appreciated.

Regards,
Andrew
  #2  
Old 17-Aug-2006, 09:44
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,720
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Hexadecimal Checksum Characters


Quote:
Originally Posted by a3.charles
At the moment i'm exclusive ORing the remaining characters in the sentence, however, this only gives me a result of one character,

One byte consists of eight bits, which contains two hexadecimal digits.

Regards,

Dave
Last edited by cable_guy_67 : 17-Aug-2006 at 17:07. Reason: Fixed broken quote tag
  #3  
Old 17-Aug-2006, 21:48
alcoholic's Avatar
alcoholic alcoholic is offline
Member
 
Join Date: Nov 2005
Posts: 170
alcoholic is on a distinguished road

Re: Hexadecimal Checksum Characters


Quote:
Originally Posted by davekw7x
One byte consists of eight bits...
One byte consists of atleast eight bits.
__________________
Gravitation is not responsible for people falling in love.
-Albert Einstein
  #4  
Old 17-Aug-2006, 22:36
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,720
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Hexadecimal Checksum Characters


Quote:
Originally Posted by alcoholic
One byte consists of atleast eight bits.

Well, the C and C++ standards say that a char is at least eight bits (they don't talk about bytes). I think the term "byte" originated at IBM a little after the middle of the 20th century. By the time it got into common usage (with the release of the IBM 360, as I recall) it designated an eight-bit quantity. Non-IBM (maybe anti-IBM) people are persnickety about referring to "octets" instead of bytes, and maybe I should have used that term. (But would it have been more clear to the Original Poster? By the same token, instead of hexadecimal digit I could have used the term "semioctet" for the 4-bit thingie that is half of an octet. Some people used to call them "nybbles". Really.)

I assume that a byte is always eight bits and has been since about 1964, and it is so commonly used that way that I didn't feel it necessary to define it in-line. Sometimes I think my posts are too wordy anyhow. No, really!

Maybe I was a little lax in not defining the terminology, and the fact that the statement that I made is (almost certainly) correct in the context of any computer system that the Original Poster is likely to run across these days is not an excuse for not being more precise. Sometimes I need a little help.

(DId I just say "almost certainly correct"? That just doesn't sound right, does it? If it's not always correct, it's not correct. Period.)

Thanks for posting.

Regards,

Dave
Last edited by davekw7x : 17-Aug-2006 at 23:12.
  #5  
Old 17-Aug-2006, 23:12
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,245
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Hexadecimal Checksum Characters


Quote:
Originally Posted by davekw7x
...instead of hexadecimal digit I could have used the term "semioctet" for the 4-bit thingie that is half of an octet.)
Or a nybble
__________________

Age is unimportant -- except in cheese
  #6  
Old 17-Aug-2006, 23:17
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,720
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Hexadecimal Checksum Characters


Quote:
Originally Posted by WaltP
Or a nybble
Believe it or not, I had just edited my post to include that term, but I was working from memory, not Wikipedia. Really. (Note that my last edit was submitted at precisely the same time as your post.) I think it's about time for one of us to sign off for now. I vote for me.

Regards,

Dave
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 3) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BIOS checksum error mohammad Computer Hardware Forum 19 18-Feb-2008 18:24
Re: Things to Avoid in C/C++ -- gets() , Part 1 WaltP C Programming Language 5 21-Jun-2007 12:13
What practical use of Bits and Hexadecimal for C programmer? Shrikharan C Programming Language 1 26-Dec-2005 21:29
fast characters in console svhb C Programming Language 10 22-Jun-2005 07:13
How to hide characters from being displayed on screen as they are keyed in? nkhambal C++ Forum 8 10-Aug-2004 09:22

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:48.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.