Velocity Reviews > checksum correction

# checksum correction

Imran
Guest
Posts: n/a

 12-10-2007

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

Richard Tobin
Guest
Posts: n/a

 12-10-2007
In article <fjjke1\$p76\$(E-Mail Removed)>,
Imran <(E-Mail Removed)> wrote:

> 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

8080 and 4C04, then it probably doesn't produce 32-bit values like
UUUUUUUU.

-- Richard
--
:wq

Johannes Bauer
Guest
Posts: n/a

 12-10-2007
Imran schrieb:

> 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.

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

--
"Viele der Theorien der Mathematiker sind falsch und klar
GotteslĂ¤sterlich. Ich vermute, dass diese falschen Theorien genau
deshalb so geliebt werden." -- Prophet und VisionĂ¤r Hans Joss aka