result Xor BitConverter.ToInt32(chars, i) analog on php

Private Function CalcHash(ByVal stringToHash As String) As String ' get character codes into an array Dim chars As Byte() = Encoding.ASCII.GetBytes(stringToHash) Dim result As Integer = 0 'step along the string in chunks of bytes For i As Integer = 0 To chars.Length - 1 Step 4 ' get 4 bytes as an int and xor into the result result = result Xor BitConverter.ToInt32(chars, i) Next ' get the negative result, no idea where the extra -1 comes from result = -result - 1 ' make sure that the resulting string is always 8 hex digits Return result.ToString("x8")End Function