I'm looking for source code to verify that a wc3 cd key will be accepted by the installer, in order to catch typos when people enter a key into my hosting bot.
Anyone have a link?
Anyone have a link?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
Public Function startCountdown() As Boolean
broadcastPacket(GID.START_COUNTDOWN, array(Of Byte)())
For i As Integer = 5 To 1 Step -1
say("Game starting in " + i.ToString(), Color.Red)
Threading.Thread.Sleep(1000)
Next i
say("Starting Game", Color.Red)
broadcastPacket(GID.START_LOADING, array(Of Byte)())
players(0).ready = True
End Function
Public Function receive_GID_PLAYER_READY(ByVal data() As Byte) As Boolean
'this player is ready
ready = True
say(name + " is ready", Color.Blue)
If send_GID_OTHER_PLAYER_READY() = False Then Return False
'look for unready players
Dim b As Boolean = True
For Each p As BnetGamePlayer In players
If p.ready = False Then b = False : Exit For
Next p
'launch when all ready
If b Then
say("All ready", Color.Blue)
Return launchLoadedGame()
End If
Return True
End Function
Public Function launchLoadedGame() As Boolean
say("Launching", Color.Blue)
'send some game data to look good
If broadcastPacket(GID.GAME_PACKET, array(Of Byte)(&HFA, &H0)) = False Then Return False
'inform the players that you are leaving
If send_GID_PLAYER_LEFT(players(0)) = False Then Return False
'tell them the new host is the second player
If send_GID_SET_HOST(players(1)) = False Then Return False
'disconnect
For Each p As BnetGamePlayer In copyOfPlayers()
If Not p.socket Is Nothing Then p.socket.disconnect()
Next p
End Function
''' <summary>Computes the crc32 value for a stream of data.</summary>
''' <param name="s">The stream to read data from.</param>
''' <param name="poly">The polynomial to be used, specified in a bit pattern. (Default is CRC-32-IEEE 802.3).</param>
''' <returns>crc32 value</returns>
Public Shared Function crc32(ByVal s As Stream, Optional ByVal poly As UInteger = &H4C11DB7) As UInteger
Dim r As New BinaryReader(s)
'Precompute the combined XOR masks for each byte
Dim xorTable(0 To 255) As UInteger
For i As Integer = 0 To 255
Dim regb As Byte = CByte(i)
For j As Integer = 7 To 0 Step -1
xorTable(i) = xorTable(i) Xor ((poly << j) * (regb >> 7))
regb = (regb << 1) Xor CByte((poly >> 24) * (regb >> 7))
Next j
Next i
'Direct Table Algorithm
Dim reg As UInteger = 0
For i As Long = 0 To s.Length - 1 - s.Position
reg = (reg << 8) Xor xorTable(CInt((reg >> 24) Xor r.ReadByte()))
Next i
Return reg
End Function
Public Function getPasswordProof() As Byte()
Dim bb As Byte()
'Compute values
'strings not null terminated, is that correct?
bb = packBytes(packString(username.ToUpper()), packString(":"), packString(password.ToUpper()))
bb = SHA1(bb)
bb = packBytes(salt, bb)
bb = SHA1(bb)
Dim x As BigNum = New BigNum(bb)
Dim v As BigNum = G.powerMod(x, N)
bb = SHA1(remoteKey.bytes)
bb = chopBytes(bb, 4)(0)
Dim u As BigNum = New BigNum(bb)
Dim S As BigNum = ((N + remoteKey - v) Mod N).powerMod(privateKey + u * x, N)
'Separate S into odd and even bytes
Dim bb1(0 To 15) As Byte, bb2(0 To 15) As Byte
For i As Integer = 0 To 15
bb1(i) = S.byteVal(2 * i)
bb2(i) = S.byteVal(2 * i + 1)
Next i
'Hash the odds and the evens
bb1 = SHA1(bb1)
bb2 = SHA1(bb2)
Dim K(0 To 19) As Byte
'Put evens to evens and odds to odds
For i As Integer = 0 To 9
'I assumed 'combine the buffers' meant this, but it could mean a ton of other things
K(2 * i) = bb1(2 * i)
K(2 * i + 1) = bb2(2 * i + 1)
Next i
'Xor the hashes of G and N together
bb1 = SHA1(G.bytes)
bb2 = SHA1(N.bytes)
For i As Integer = 0 To bb1.Length - 1
bb1(i) = bb1(i) Xor bb2(i)
Next i
'Get the full hash
bb = SHA1(packString(username.ToUpper()))
bb = packBytes(bb1, bb, salt, publicKey.bytes, remoteKey.bytes, k)
bb = SHA1(bb)
Return bb
End Function
Page created in 0.046 seconds with 13 queries.