Valhalla Legends Forums Archive | Battle.net Bot Development | Re: Storm.dll Function

AuthorMessageTime
aton
just write your own, its the standard udp header checksum algorithm, read the udp rfc


edit: sorry this is not correct. its absolutely not the udp header checksum algo.
i am looking for the correct checksum function in c atm
May 1, 2005, 10:58 AM
iago
Hmm, I found it one time, but it's not so cut-and-dry.  It's in the middle of a very very very long Storm function.
May 1, 2005, 3:01 PM
Archangel
[quote]
« on: June 19, 2004, 07:24 pm »
[/quote]

« Reply #6 on: Today at 05:58:55 AM »

Today: May 01, 2005, Almost 1 year.
May 1, 2005, 10:24 PM
JoeTheOdd
Hop off. He said its the default header, thus helped someone.
May 2, 2005, 12:47 AM
Archangel
[code]
Private Function SubCheckSum(ByVal buf As String, ByVal length As Integer) As Long
    Dim sum1, sum2
    Dim i As Integer, iY As Integer
        For iY = 0 To length - 1
            i = length - iY
            sum2 = sum2 + Asc(Mid(buf, i, 1))
            If sum2 > &HFF Then
                sum2 = sum2 - &HFF
            End If
            sum1 = sum1 + sum2
        Next iY
        SubCheckSum = (LShift((sum2 And &HFF), 8)) Or ((sum1 Mod &HFF) And &HFF)
End Function

Private Function UDPCheckSum(buf As String) As Integer
    Dim subsum As Long, length As Integer
    Dim a As Long, b As Long, Ret As Integer
        CopyMemory length, ByVal Mid$(buf, 3, 2), 2
        length = length - 2
        subsum = SubCheckSum(Mid$(buf, 3), length)
        a = &HFF - ((subsum And &HFF) + (RShift(subsum, 8))) Mod &HFF
        b = CLng((((&HFF - (a + RShift(subsum, 8)) Mod &HFF) And &HFF) Or LShift(a, 8)))
        CopyMemory Ret, b, 2
        UDPCheckSum = Ret
End Function
[/code]

Starcraft UDP Documentation:
http://www.archangel.bnetweb.com/projecto/starcraft_udp/Starcraft%20UDP.zip

*Authors: Pianka & ArchAngel
*This documentation is not complete, might be wrong and will not be finished.
*But if you are looking for adding something or correcting something i will do it with the specific credits.
May 2, 2005, 3:38 AM

Search