Calculating the Checksum

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)
ivano_osti
Brazil
Posts: 415
Joined: 17 Nov 2017, 20:02
Location: Itapira-SP, Brazil

Calculating the Checksum

Post by ivano_osti » 27 Jun 2007, 22:39

 Posted by:  Ivano Edilberth Osti 

Hi.

I have a document that shows "how to calculate" a checksum. I tried a lot
but with no success. The document says:

>

I know how to use the eXclusive OR but I could not understand "how to apply"
it in the sample.

For example, taking a look at the data that I'm collecting, I know that the
content below generates the checksum "2F". This checksum is correct for the
content. See:
/CN:2 /KN:1/OP:1 /NU:813680 /NA:JORSA- ITA
/SL:051.181/SW:016.063/SS:0322/NO:05/TO:12 /CS:

After calculate the checksum, I have: /CN:2 /KN:1/OP:1 /NU:813680
/NA:JORSA- ITA /SL:051.181/SW:016.063/SS:0322/NO:05/TO:12
/CS:2F

Any tip is welcome.

Warmest regards.

PS: Attached the document and a sample made by me that fails...

You do not have the required permissions to view the files attached to this post.

cschubert
Germany
Posts: 867
Joined: 23 May 2018, 11:26
Location: Germany

Re: Calculating the Checksum

Post by cschubert » 02 Jul 2007, 20:59

 Posted by:  Christian Schubert 

Hi,

I guess your problem is that you use "SalStrToNumber" where "SalStrLop"
would be correct.
I guess it would look like that:

--------------------
...
If lsValue = ''
Return '??'
Set nPos = 0
Loop
If lsValue = ''
Break
Set nA = SalStrLop( lsValue )
Set nSoma = nSoma + fXOR( nSoma , nA )
...
-----------------------

Not included is a break condition to stop the calculation.
Probably this is not totally correct because I didn't take the time to try
to understand everything but it could point you to the right direction :-)

HTH

Christian Schubert

ivano_osti
Brazil
Posts: 415
Joined: 17 Nov 2017, 20:02
Location: Itapira-SP, Brazil

Re: Calculating the Checksum

Post by ivano_osti » 02 Jul 2007, 22:46

 Posted by:  Ivano Edilberth Osti 

Hi Christian.

Thank you a lot for your answer.

It not worked. I'll keep on trying.

>
Yes, I agree with you.

The manual that I have is not so clear on "how to calculate" (or I'm the
problem...)

Warmest regards.

Krzysztof Dorko

Re: Calculating the Checksum

Post by Krzysztof Dorko » 04 Jul 2007, 05:59

 Posted by:  Krzysztof Dorko 

Hi
I do not analyze your code but
Probably this should help :)

Kris

You do not have the required permissions to view the files attached to this post.

ivano_osti
Brazil
Posts: 415
Joined: 17 Nov 2017, 20:02
Location: Itapira-SP, Brazil

Re: Calculating the Checksum

Post by ivano_osti » 04 Jul 2007, 16:30

 Posted by:  Ivano Edilberth Osti 

Hi Krzysztof.

It worked fine :-))

You helped me a lot to keep on having progress in my project.

Thank you a lot.

Also thanks to Christian Schubert and Jeff Luther.

Count on me.

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ccbot] and 0 guests