• Welcome to Valhalla Legends Archive.
 

Adron

Started by pianka, June 23, 2004, 04:41 PM

Previous topic - Next topic

pianka

The two functions in NBBot called UDPChecksum() and SubChecksum(), are they proven to work?

GoSuGaMING

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

MyndFyre

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

pianka

Please accept my apology;)

GoSuGaMING

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!

Zakath

#5
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.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Lenny

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....
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Blaze

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
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

R.a.B.B.i.T

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

PaiD


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

Newby

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

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Blaze

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
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

UserLoser.

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.

pianka

So does that mean nobody is gonna post it for me? :(

hismajesty

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!"