The two functions in NBBot called UDPChecksum() and SubChecksum(), are they proven to work?
Quote from: PiaNKA on June 23, 2004, 04:41 PM
The two functions in NBBot called UDPChecksum() and SubChecksum(), are they proven to work?
test them :X
A little rant on forum etiquette...
1.) If you wanted this to go to Adron, you should have sent him a private message. If you wanted other people to reply to your question, a more descriptive title, such as "Accuracy of NBBot Checksum functions" might have been more appropriate.
2.) Gosu -- this might be a bit of a suprise to you, but you don't have to reply to *every* thread. You don't contribute much at all to the realm of original knowledge. To suggest that he "test" the functions would be to suggest that he compile a list of all possible input and output values and run them through the function. Impractical, I might say. And warzone's thread -- your blinding revelation of "buy a book" (where one or two people had already suggested it) is the same way. Perhaps suggesting a specific book would have been helpful, but what you said was just a way to get your name on the post.
And I'm spent.
Please accept my apology;)
Quote from: Myndfyre on June 23, 2004, 06:11 PM
A little rant on forum etiquette...
1.) If you wanted this to go to Adron, you should have sent him a private message. If you wanted other people to reply to your question, a more descriptive title, such as "Accuracy of NBBot Checksum functions" might have been more appropriate.
2.) Gosu -- this might be a bit of a suprise to you, but you don't have to reply to *every* thread. You don't contribute much at all to the realm of original knowledge. To suggest that he "test" the functions would be to suggest that he compile a list of all possible input and output values and run them through the function. Impractical, I might say. And warzone's thread -- your blinding revelation of "buy a book" (where one or two people had already suggested it) is the same way. Perhaps suggesting a specific book would have been helpful, but what you said was just a way to get your name on the post.
And I'm spent.
is this a wasted post? just like wasted bandwidth to brighten the day!
GoSuGaMING: This might also come as a surprise to you, but a lot of people here think you are a complete and total ass. If you don't clean up your act, I will request that you be banned from the forum - and I'm on excellent terms with the forum admins, so my request WILL be granted.
You have been warned.
On a lighter note, can anyone post UDPChecksum() and SubChecksum() (maybe Pianka)?
I'm curious as to what it looks like and how it works....
Quote from: Zakath on June 23, 2004, 08:54 PM
GoSuGaMING: This might also come as a surprise to you, but a lot of people here thing you are a complete and total ass.
I agree totally.
Quote from: Kk)Blaze(kK on June 23, 2004, 09:14 PM
Quote from: Zakath on June 23, 2004, 08:54 PM
GoSuGaMING: This might also come as a surprise to you, but a lot of people here thing you are a complete and total ass.
I agree totally.
Second.
Anyway, I'd also like to see these functions.
unsigned long subchecksum(unsigned char *buf, int len)
{
unsigned sum1=0, sum2=0;
unsigned char *p;
p = buf+len-1;
while(len--) {
sum2 += *p--;
if(sum2 > 0xff)
sum2 -= 0xff;
sum1 += sum2;
}
return ((sum2 & 0xff)<<8) | ((sum1 % 0xff) & 0xff);
}
I cant find the other
Public Function UDPChecksum(ByVal buffer As String, ByVal size As Long) As Long
Dim a&, b&, n&, q&, sum&
For n = 0 To size - 1
a = a + ((n + 1) * Asc(Mid$(buffer, n + 1, 1)))
b = b + ((n + 2) * Asc(Mid$(buffer, n + 1, 1)))
Next n
q = a
While (q > &HFF)
q = (q / &H100) + (q Mod &H100)
Wend
sum = q
q = b
While (q > &HFF)
q = (q / &H100) + (q Mod &H100)
Wend
sum = sum + (LShift(&HFF - q, 8))
UDPChecksum = sum
End Function
And the vb version of checksum...
Public Sub InitCRC32()
Dim i As Long, J As Long, K As Long, XorVal As Long
Static CRC32Initialized As Boolean
If CRC32Initialized Then Exit Sub
CRC32Initialized = True
For i = 0 To 255
K = i
For J = 1 To 8
If K And 1 Then XorVal = CRC32_POLYNOMIAL Else XorVal = 0
If K < 0 Then K = ((K And &H7FFFFFFF) \ 2) Or &H40000000 Else K = K \ 2
K = K Xor XorVal
Next
CRC32Table(i) = K
Next
End Sub
Public Function CRC32(ByVal data As String) As Long
Dim i As Long, J As Long
Call InitCRC32
CRC32 = &HFFFFFFFF
For i = 1 To Len(data)
J = CByte(Asc(Mid(data, i, 1))) Xor (CRC32 And &HFF&)
If CRC32 < 0 Then CRC32 = ((CRC32 And &H7FFFFFFF) \ &H100&) Or &H800000 Else CRC32 = CRC32 \ &H100&
CRC32 = CRC32 Xor CRC32Table(J)
Next
CRC32 = Not CRC32
End Function
'Put this in some module...
Public Const CRC32_POLYNOMIAL As Long = &HEDB88320
Public CRC32Table(0 To 255) As Long
Quote from: Kk)Blaze(kK on June 24, 2004, 12:21 AM
And the vb version of checksum...
Wrong checksum -- read the thread before replying.
So does that mean nobody is gonna post it for me? :(
Quote from: Zakath on June 23, 2004, 08:54 PM
GoSuGaMING: This might also come as a surprise to you, but a lot of people here think you are a complete and total ass. If you don't clean up your act, I will request that you be banned from the forum - and I'm on excellent terms with the forum admins, so my request WILL be granted.
You have been warned.
You forgot "moron!"
Would someone explain what those 2 functions are used for? I am a little lost >:(
Quote from: BaDDBLooD on June 27, 2004, 11:47 PM
Would someone explain what those 2 functions are used for? I am a little lost >:(
udp packet checksum which is used for the games that use udp.
Which games would that be?
Quote from: BaDDBLooD on June 28, 2004, 12:13 AM
Which games would that be?
prolly starcraft & Broodwar
Quote from: GoSuGaMING on June 23, 2004, 08:52 PM
Quote from: Myndfyre on June 23, 2004, 06:11 PM
A little rant on forum etiquette...
1.) If you wanted this to go to Adron, you should have sent him a private message. If you wanted other people to reply to your question, a more descriptive title, such as "Accuracy of NBBot Checksum functions" might have been more appropriate.
2.) Gosu -- this might be a bit of a suprise to you, but you don't have to reply to *every* thread. You don't contribute much at all to the realm of original knowledge. To suggest that he "test" the functions would be to suggest that he compile a list of all possible input and output values and run them through the function. Impractical, I might say. And warzone's thread -- your blinding revelation of "buy a book" (where one or two people had already suggested it) is the same way. Perhaps suggesting a specific book would have been helpful, but what you said was just a way to get your name on the post.
And I'm spent.
is this a wasted post? just like wasted bandwidth to brighten the day!
It is only wasted if you don't learn from it that many forum regulars consider your posts to be drivel.
Quote from: PiaNKA on June 23, 2004, 04:41 PM
The two functions in NBBot called UDPChecksum() and SubChecksum(), are they proven to work?
As far as I know, they work. They've been around for years, so they must be doing something right.
Whoever asked for the function -- this can be gotten from the NBBot source code, which can be found at, among other places, at warz' site -->
http://tks.slacktech.com (http://tks.slacktech.com) Ok, the actual page is Here (http://tks.slacktech.com/source/index.php?dir=cpp/&file=Nbbot107.rar) if you don't want to make the 2 clicks to find it (source, then cpp).