DWORD XOR In C#

Hello, Im trying convert one project c++ to c#. And i have question about XOR's.

1
2
(DWORD*)(m_pPacket + woffset)
                                = *(DWORD*)(m_pPacket + roffset) ^ *(DWORD*)(m_pXOR_ENCODE_BYTES + xoffset);


m_pXOR_ENCODE_BYTES,m_pPacket is char array, But i dont know how to convert it to c#

anyone can help me about that ?


Sorry my english not good, Thanks.
This question belongs to a C# forum.
C# doesn't have pointers
@viliml

ok but, how to i can convert that to c# ? nobody cant do that?
Well you do have arrays and strings there... Hmmm... Let me think.
Something like (int)(m_packet[woffset])=(int)(m_packet[roffset])^(int)(m_pXOR_ENCODE_BYTES[xoffset]);
But I'm not sure, and it will maybe not work, and I work on C# next to never so...
Try this: m_packet[woffset] = (/*type of m_packet's element*/)((int)(m_packet[woffset]) ^ (int)(m_pXOR_ENCODE_BYTES[xoffset]));
closed account (1yR4jE8b)
C# doesn't have pointers


This is not true.

http://msdn.microsoft.com/en-us/library/y31yhkeb%28v=vs.100%29.aspx

But it's a pain in the ass to enable them and use unsafe contexts, so it's typically better to just ignore them.
Topic archived. No new replies allowed.