473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Help calculate checksum (newbie)

Hello.

I have a situation where need to calculate a checksum of some byte array.
Here's the sample output from server:
2008-09-30 11:35:00 `SC`00541.00TJ123456PPC 00000000DLGLGN
00000001TXBEG Login:user=mmlos, pswd=osmp

The checksum is 9afb81c7

I cannot figure out where this checksum come from, can anyone post a sample
in vb.net or C#?
See the packet description at http://www.epay.tj/img/MML-Packets.jpg
Any help on that whould be greatly appreciated.

Adriano
Oct 15 '08 #1
3 6099
"Adriano" <ad*****@mail.itschrieb:
I have a situation where need to calculate a checksum of some byte array.
Here's the sample output from server:
2008-09-30 11:35:00 `SC`00541.00TJ123456PPC 00000000DLGLGN
00000001TXBEG Login:user=mmlos, pswd=osmp

The checksum is 9afb81c7

I cannot figure out where this checksum come from, can anyone post a
sample in vb.net or C#?
See the packet description at http://www.epay.tj/img/MML-Packets.jpg
Doesn't the packet description contain information on how to calculate the
checksum (4.)?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Oct 15 '08 #2
Yes it does, but I can't figure out how to calculate it using vb or c#.
Can you help me?

thanks in advance,
Adriano
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:OF**************@TK2MSFTNGP04.phx.gbl...
"Adriano" <ad*****@mail.itschrieb:
>I have a situation where need to calculate a checksum of some byte array.
Here's the sample output from server:
2008-09-30 11:35:00 `SC`00541.00TJ123456PPC 00000000DLGLGN
00000001TXBEG Login:user=mmlos, pswd=osmp

The checksum is 9afb81c7

I cannot figure out where this checksum come from, can anyone post a
sample in vb.net or C#?
See the packet description at http://www.epay.tj/img/MML-Packets.jpg

Doesn't the packet description contain information on how to calculate the
checksum (4.)?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Oct 16 '08 #3
What's the description of the calculation? There are many different ways
to calculate a checksum.

Here's one from VB6 that I use for my own purposes:
Dim k as Integer
k = 0
While Loc(1) < LOF(1) - 4
FileGet(1, j)
k = k Xor j
End While
FileClose()
ItemX.Add(Hex(k).PadLeft(8, "0"))

The (-4) is because that's where some additional data is stored that is
excluded from the calculation. This example is an XOR - adding
modulo(something) is also common. The result is an 8-byte hex value, same as
yours.

"Adriano" <ad*****@mail.itwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Yes it does, but I can't figure out how to calculate it using vb or c#.
Can you help me?

thanks in advance,
Adriano

Oct 17 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Abby | last post by:
I have an array which contain Hex no. in each position. For examples, unsigned char data; data = 0x00; data = 0x01; data = 0x02; data = 0xE; data = 0xEF; --> This is the checksum value
3
by: Steve | last post by:
Please take a look at the simple console app code below: #include "stdafx.h" #using <mscorlib.dll> using namespace System; typedef struct { unsigned long checkSum;
4
by: Sparky Arbuckle | last post by:
How do I successfully pass a value my Business object (.vb) to my .aspx page? Right now I am trying to use this: Imports System Imports Microsoft.VisualBasic Namespace ASDFComponents ...
12
by: wjb131 | last post by:
hi all, below you find my simple python version of MD2 algorithm as described in RFC1319 (http://rfc1319.x42.com/MD2). It produces correct results for strings shorter than 16 Bytes and wrong...
1
by: ampeloso | last post by:
Hello, I have the following function: WORD calcChecksum(BYTE data, WORD length) When I get to i_data= (WORD*)data; the i_data becomes 6272. data, which is data is 128. Someone gave me this...
1
by: Webstorm | last post by:
Hi, I hope someone can help me sort this out a bit, Im completely lost. Here is the page I am working on: http://www.knzbusinessbrokers.com/default.asp I have 3 search critera that I need to...
9
by: lombardm | last post by:
I am trying to decipher/translate some code that I have no experience with. I am trying to find out how the checksum is computed for a Megellan Explorist GPS Waypoint (POI) file. Below is the...
5
by: =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post by:
Hi, how can I calculate the checksum (CRC-16) from the byte I retrieve from a hardware device through the RS232 serial port? Christian
11
by: A.C. | last post by:
hi i m declaring a structure globally & there is func1 & main. i m assigning the value to variable(this is a pointer) of structure in fun1 & want to print it in main. this is same kind of...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.