checksum correction

I

Imran

Hello all

I am trying to calculate a checksum correction for 16 byte checksum
calculation.

I have 1 lines of data

xxxxxxxxyyyyyyyy80804C0400004204UUUUUUUU

What I am trying to achive is to find a right UUUUUUUU
value so that when I reclaculate the checksum of whole
line, it should be yyyyyyyy.

My tried / failed algoritham is as follows

int final_cks(UUUUUUUU) = xxxxxxxx + 8080+4C04+0000+4204 - yyyyyyyy

i will patch this final_cks to UUUUUUUU, then i re-calculate the checksum
again,

int final_cks= xxxxxxxx + 8080+4C04+0000+4204 +UUUU+UUUU

it should be equal to yyyyyyyy


Any sugg?

Thank you
 
R

Richard Tobin

Imran said:
I am trying to calculate a checksum correction for 16 byte checksum
calculation.

I have 1 lines of data

xxxxxxxxyyyyyyyy80804C0400004204UUUUUUUU

What I am trying to achive is to find a right UUUUUUUU
value so that when I reclaculate the checksum of whole
line, it should be yyyyyyyy.

You don't say what the checksum algorithm is. Many checksums are
deliberately designed to make it it hard to do what you want.
My tried / failed algoritham is as follows

int final_cks(UUUUUUUU) = xxxxxxxx + 8080+4C04+0000+4204 - yyyyyyyy

If your checksum algorithm involves adding up 16-bit quantities like
8080 and 4C04, then it probably doesn't produce 32-bit values like
UUUUUUUU.

-- Richard
 
J

Johannes Bauer

Imran said:
i will patch this final_cks to UUUUUUUU, then i re-calculate the checksum
again,

int final_cks= xxxxxxxx + 8080+4C04+0000+4204 +UUUU+UUUU

it should be equal to yyyyyyyy

UUUUUUUU needs to be 42.

Seriously, nobody will be able to help you without telling which
algorithm you use. There is no such thing as "the" 16-bit checksum
function. But anyways, it doesn't have anything to do with C.

Greetings,
Johannes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,245
Latest member
Evelyne64L

Latest Threads

Top